【发布时间】:2019-06-09 20:16:01
【问题描述】:
在我的 IIS Express 上一切正常,但在生产中我遇到了错误。我该如何解决这个问题?
找不到方法: 'System.Collections.ObjectModel.Collection
1<System.Net.Http.DelegatingHandler> System.Web.Http.HttpConfiguration.get_MessageHandlers()'.1 System.Web.Http.HttpConfiguration.get_MessageHandlers()'。资源 错误:执行过程中产生了未处理的异常 当前的网络请求。有关起源和位置的信息 可以使用异常堆栈跟踪来识别异常 以下。堆栈跟踪:[MissingMethodException:找不到方法: 'System.Collections.ObjectModel.Collection
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'System.Collections.ObjectModel.Collection1<System.Net.Http.DelegatingHandler> System.Web.Http.HttpConfiguration.get_MessageHandlers()'.]1 配置回调)+46
CDW.WebApiConfig.Register(HttpConfiguration config) in L:\W\App_Start\WebApiConfig.cs:25
System.Web.Http.GlobalConfiguration.Configure(Action
L:\W\Global.asax.cs:17 中的 CDW.WebApiApplication.Application_Start() [HttpException(0x80004005):找不到方法: 'System.Collections.ObjectModel.Collection1<System.Net.Http.DelegatingHandler> System.Web.Http.HttpConfiguration.get_MessageHandlers()'.]1 System.Web.Http.HttpConfiguration.get_MessageHandlers()'。]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +517
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +185
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369 [HttpException (0x80004005): Method not found: 'System.Collections.ObjectModel.Collection
System.Web.HttpRuntime.FirstRequestInit(HttpContext 上下文) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext 上下文) +111 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest WR,HttpContext 上下文)+714
版本信息:
Microsoft .NET Framework 版本:4.0.30319;
ASP.NET 版本:4.7.3282.0
【问题讨论】:
-
要在黑暗中试一试,并说您的所有代码都没有到达您发布的位置吗?
-
很可能您缺少操作系统中默认的引用,或者您的生产环境 IIS 配置错误。
-
使用 Microsoft 的“程序集绑定日志查看器”(Fuslogvw.exe) 确保您没有缺少程序集。 docs.microsoft.com/en-us/dotnet/framework/tools/…