我有一个Swagger可以完美运行的开发环境。
我采用相同的代码并将其部署到另一个环境中,在该环境中出现错误:
[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
我确定这是环境问题。我尝试了删除的所有内容
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
并替换为
SwaggerConfig.Register();
GlobalConfiguration.Configure(WebApiConfig.Register);
当部署刚在另一个环境中工作的相同代码时,我仍然遇到相同的错误。
这是我需要允许IIS触发PreApplicationStartMethod的IIS设置吗?