New MVC 4 web application using autofac 3.0 on IIS 7.5. How to add dependency in IHttpModule?
I tried using the constructor, which resulted in:
Constructor of type AnonymousIdentityModule not found
Thus, it seems that the internal elements need a parameterless constructor for the http modules. I also tried to inject properties, but this did not lead to the actual injection of the dependency.
registration
builder.RegisterType<AnonymousIdentityModule>().As<IHttpModule>().PropertiesAutowired().InstancePerHttpRequest();
IHttpModule Code
public class AnonymousIdentityModule : IHttpModule { private readonly IServiceManager _serviceManager;
web.config
<system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules> <add name="AnonymousIdentityModule" type="AnonymousIdentityModule" /> </modules> </system.webServer>
I found this old article related to Windsor, but did not find an analogue in the autofac.
source share