Lamar causes 500.30 error when using ServiceRegistry


I am using Lamar as the DI for .Net Core (2.2) Web API.


    public class Program
        public static void Main(string[] args)

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>

When I have following code at Startup.cs the program starts fine.

        public void ConfigureServices(IServiceCollection services)
        { }

As soon as I change the method to this

        public void ConfigureServices(ServiceRegistry services)
        { }

Starting the Web API will show

HTTP Error 500.30 - ANCM In-Process Start Failure

In Event Viewer there are couple of Errors.

Application '/LM/W3SVC/2/ROOT' with physical root 'C:\xxx\path\to\Web.API\' hit unexpected managed exception, exception code = '0xe0434352'. Please check the stderr logs for more information.


Application '/LM/W3SVC/2/ROOT' with physical root 'C:\xxx\path\to\Web.API\' failed to load clr and managed application. CLR worker thread exited prematurely
asked on Stack Overflow May 6, 2019 by Juho Rutila

1 Answer


This error is caused because I just replaced ConfigureServices call with the ServiceRegistry. I should actually use ConfigureContainer:

        public void ConfigureContainer(ServiceRegistry services)
        { }
answered on Stack Overflow May 6, 2019 by Juho Rutila

User contributions licensed under CC BY-SA 3.0