无法识别 URL 意外以 '/$metadata' 结尾的请求格式



以为我会尝试看看是否有人看过这个或类似的东西,因为我不确定从哪里开始寻找。我有一堆网络服务,它们在很长一段时间内都很好,但现在我的服务器人员说他们给出了一个我以前从未见过的错误。有什么想法/东西要看吗?

Log Name:      Application
Source:        ASP.NET 4.0.30319.0
Date:          6/12/2012 6:57:03 AM
Event ID:      1309
Task Category: Web Event
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      Server
Description:
Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 6/12/2012 6:57:03 AM 
Event time (UTC): 6/12/2012 1:57:03 PM 
Event ID: 691c9c8fabeb4701aa31488d6db060ce 
Event sequence: 123578 
Event occurrence: 1 
Event detail code: 0 
Application information: 
Application domain: domain
Trust level: Full 
Application Virtual Path: / 
Application Path: D:Siteswebroot 
Machine name: Server
Process information: 
Process ID: 2456 
Process name: w3wp.exe 
Account name: IIS APPPOOLAppPool_AID1651 
Exception information: 
Exception type: InvalidOperationException 
Exception message: Request format is unrecognized for URL unexpectedly ending in '/$metadata'.
at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

谢谢!

您所需要的只是将以下内容添加到您的 web.config 中

<configuration>
  <system.web>
    <webServices>
      <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
      </protocols>
    </webServices>
  </system.web>
</configuration>

我的网络服务也记录Event Code 3005 .我使用 JQuery $.ajax() 调用我的 Web 服务,它会产生两个 http 请求。第一个请求是"选项"请求,它会遇到一条500 Internal Server Error消息。这是用Event Code 3005记录的那个。第二个请求是"POST"请求,它会遇到来自 Web 服务的正确答案。

我试图防止"OPTIONS"请求被记录为错误并没有成功,但我希望这些信息对您有所帮助。

我的错误日志也与您的短语匹配:

异常消息:无法识别 URL 的请求格式意外以 ...

相关内容

最新更新