On my IIS Express everything works fine, but in production im getting an error. How can i solve that problem?
Method not found: 'System.Collections.ObjectModel.Collection
1<System.Net.Http.DelegatingHandler> System.Web.Http.HttpConfiguration.get_MessageHandlers()'.
1 System.Web.Http.HttpConfiguration.get_MessageHandlers()'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [MissingMethodException: Method not found: '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 configurationCallback) +46
CDW.WebApiConfig.Register(HttpConfiguration config) in L:\W\App_Start\WebApiConfig.cs:25
System.Web.Http.GlobalConfiguration.Configure(Action
CDW.WebApiApplication.Application_Start() in L:\W\Global.asax.cs:17 [HttpException (0x80004005): Method not found: '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 context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714
Version Information:
Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.7.3282.0
I had the same problem. I solved this by adding the following code in webconfig
.
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
User contributions licensed under CC BY-SA 3.0