I use nuget simple injector mvc integration quick start to install simple injector v2.5.2 and related packages to my helloworld mvc project. It works fine in my local express IIS. But after I upload it to production IIS server, it throws exception
[MissingMethodException: No parameterless constructor defined for this object.] .... Make sure that the controller has a parameterless public constructor
The SimpleInjectorInitializer class code snippet as below.
var container = new Container(); container.Register<IService, Service>(); container.RegisterMvcControllers(Assembly.GetExecutingAssembly()); container.Verify(); DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
This stackoverflow post can't help me, DependencyResolver.SetResolver is already called.
How to fix it? Did my production IIS miss any configuration?