gpt4 book ai didi

升级到 Visual Studio 2012 RC : Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation 后出现 ASP.NET Web API 错误

转载 作者:行者123 更新时间:2023-12-04 00:36:13 24 4
gpt4 key购买 nike

升级到 Visual Studio 2012 后,我无法再访问任何 ApiController,抛出以下错误:

Server Error in '/' Application.

Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.

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: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.

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: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.]
System.Web.Http.WebHost.HttpControllerHandler.AddHeaderToHttpRequestMessage(HttpRequestMessage httpRequestMessage, String headerName, String[] headerValues) +0
System.Web.Http.WebHost.HttpControllerHandler.ConvertRequest(HttpContextBase httpContextBase) +248
System.Web.Http.WebHost.HttpControllerHandler.BeginProcessRequest(HttpContextBase httpContextBase, AsyncCallback callback, Object state) +79
System.Web.Http.WebHost.HttpControllerHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +268
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626

有谁知道如何解决这个问题?

最佳答案

您在项目中引用了旧版本的 System.Net.Http。要解决此问题,请转到项目中的“引用”下,删除 System.Net.Http,然后添加 .NET 4.5 附带的版本。那应该这样做。

亨里克

关于升级到 Visual Studio 2012 RC : Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation 后出现 ASP.NET Web API 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10862728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com