Question: How to add Autofac to LambdaEntryPoint in net core 3.0?
See original GitHub issueHi,
I am testing out an api project with Amazon.Lambda.AspNetCoreServer and i stumbled upon a problem which i am not sure how to proceed with.
Autofac has changed how its added:
New way: With IHostBuilder .UseServiceProviderFactory(new AutofacServiceProviderFactory()
Old Way: With IWebHostBuilder serviceCollection.AddAutofac()
Also from my understanding IWebHostBuilder will be deprecated which LambdaEntryPoint is using in the Init method.
For the IWebHostBuilder when i try to add Autofac i get this info message from the method:
ONLY FOR PRE-ASP.NET 3.0 HOSTING. THIS WON’T WORK FOR ASP.NET CORE 3.0+ OR GENERIC HOSTING.
And i cant use IHostBuilder with LambdaEntryPoint.
Anyone has done this or has any ideas how to proceed? Thanks in advance!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Recommended way to configure Autofac in ASP.NET Core ...
In ASP.NET Core 2.0, I used ConfigureServices method on Startup class to wire-up Autofac, wrap existing services registrations and add ...
Read more >ASP.NET Core — Autofac 7.0.0 documentation
In your Startup class (which is basically the same across all the versions of ASP.NET Core) you then use ConfigureContainer to access the...
Read more >How to use Autofac in ASP.Net Core
The first step is to create a container builder to register the necessary services with the Autofac container. The first step is to...
Read more >[Fix]-I have error when i want to use httpclient in blazor server
Coding example for the question I have error when i want to use httpclient in blazor server. ... Net Core 2.2 Upgrade -...
Read more >Autofac with ASP.net core 3.1
Installing Autofac in your .Net Core project. Right-click on your project and select the NuGet package manager and install “Autofac” and “Autofac.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah I see now the continual use if IWebHostBuilder is a blocker for using Autofac in .NET Core 3.1. Sorry I should have switched to IHostBuilder as part of the major version change that went out with .NET Core 3.1. I was trying to avoid complexity with this library also supporting .NET Core 2.1 which does use IWebHostBuilder.
I don’t want to make significant set breaking changes just a couple weeks after the last major version came out so let me think if there is a less invasive approach to unblock you all.
Version 5.1.0 of
Amazon.Lambda.AspNetCoreServer
went out today with this change.I also published a blog post that has a section describing the change. https://aws.amazon.com/blogs/developer/one-month-update-to-net-core-3-1-lambda/