I have a dev environment where Swagger works perfectly.
I take this same code and deploy to another environment, where I get error:
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +704
I am sure it is an environmental issue. I tried everything where I removed
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
and replaced it with
SwaggerConfig.Register();
GlobalConfiguration.Configure(WebApiConfig.Register);
I still get the same error when I deploy the same code that just worked on another environment.
Is this an IIS Setting that I need to allow IIS to fire PreApplicationStartMethod?