c# - Dependency injection with Autofac, MVC5 and OWIN not working -


I'm having trouble integrating Autofac with MVC5 and Owin It seems that MVC is leaving AutofacMvc integration And still using System.Web.Mvc.DefaultControllerFactory to instantiate a controller, thus

  there is no parameter creator defined for this object  < / Pre> 

Alex is a great article on Mayor-Galvus, I followed this, and followed the downloaded packages, But still is not working. Here looks like my startup CC:

  Public Zero Configuration (IAppBuilder app) {var Container = AutoFac Config Registration (); App.UseAutofacMiddleware (container); // 1 - AutoFac Middleweight (AutoFac.Internation.Onwin DLL) app Setting up Usatophak MVC (); // 2 - On the MVC request made in OVN, the life time scope is going on (Autofac.Integration.Mvc.Owin) DependencyResolver.SetResolver (New AutofacDependencyResolver (Container)); // 3- Configure dependency resolver settings (AutoFac.Inmac. MVC) root for MVC. Registrar (Route. Route); }   

I checked that my service was registered, if I remove the service parameter from the constructor, then my route is successfully set. What else am I missing? Any sign where the problem may be false will be appreciated.

Obviously, this problem lied to the fact that I had to register the controllers in AutoFac Forgotten this line is adding the problem:

  Builder. Registrar Controllers (Assembly. Gate Contingency Assembly);    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -