question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: How to add Autofac to LambdaEntryPoint in net core 3.0?

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
normjcommented, Apr 15, 2020

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.

2reactions
normjcommented, Apr 28, 2020

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/

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found