简体   繁体   English

WCF服务的响应不一致

[英]Inconsistent response from the WCF service

I have a WCF service that is hosted in IIS7, this service is just a wrapper of another service, so what it does it calls the actual service then return a response which is then passed on to the client. 我有一个IIS7中托管的WCF服务,该服务只是另一个服务的包装,因此它调用实际的服务,然后返回响应,然后将响应传递给客户端。 The issue that I'm having is that I send a request and it returns data, when I send another request with the second then I get the below error: Please will you share some light on what could be a problem here. 我遇到的问题是我发送了一个请求,并返回了数据,当我在第二个请求中发送了另一个请求时,出现以下错误:请您就此可能出现的问题分享一些看法。

<!DOCTYPE html>
<html>
<head>
    <title>Specified argument was out of the range of valid values.<br>Parameter name: value</title>
    <meta name="viewport" content="width=device-width" />
    <style>
     body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
     p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
     b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
     H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
     H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
     pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
     .marker {font-weight: bold; color: black;text-decoration: none;}
     .version {color: gray;}
     .error {margin-bottom: 10px;}
     .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
     @media screen and (max-width: 639px) {
      pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
     }
     @media screen and (max-width: 479px) {
      pre { width: 280px; }
     }
   </style>
</head>

<body bgcolor="white">

        <span><H1>Server Error in '/VendorSelfCarewebapi' Application.<hr width=100% size=1 color=silver></H1>

        <h2> <i>Specified argument was out of the range of valid values.<br>Parameter name: value</i> </h2></span>

        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
           <b> Description: </b>   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.
        <br><br>

        <b> Exception Details: </b>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.<br>Parameter name: value<br><br>

        <b>Source Error:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>
                  <code>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.</code>
              </td>
           </tr>
        </table>
        <br>
        <b>Stack Trace:</b> <br><br>
        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>
                <code><pre>
                [ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
                Parameter name: value]
                 System.Web.HttpResponse.set_StatusDescription(String value) +3165151
                 System.Web.HttpResponseWrapper.set_StatusDescription(String value) +9
                 System.Web.Http.WebHost.HttpControllerHandler.CopyResponseStatusAndHeaders(HttpContextBase httpContextBase, HttpResponseMessage response) +53
                 System.Web.Http.WebHost.&lt;ConvertResponse&gt;d__6.MoveNext() +96
                 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
                 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
                 System.Web.Http.WebHost.&lt;ProcessRequestAsyncCore&gt;d__0.MoveNext() +381
                 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
                 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
                 System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +60
                 System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +6
                 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651516
                 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
                </pre></code>

              </td>
           </tr>
        </table>

        <br>

        <hr width=100% size=1 color=silver>

        <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34274

        </font>

</body>
</html>

[ArgumentOutOfRangeException]: Specified argument was out of the range of valid values.
Parameter name: value
   at System.Web.HttpResponse.set_StatusDescription(String value)
   at System.Web.HttpResponseWrapper.set_StatusDescription(String value)
   at System.Web.Http.WebHost.HttpControllerHandler.CopyResponseStatusAndHeaders(HttpContextBase httpContextBase, HttpResponseMessage response)
   at System.Web.Http.WebHost.HttpControllerHandler.<ConvertResponse>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.WebHost.HttpControllerHandler.<ProcessRequestAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
   at System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

It's a REST service? 这是REST服务吗? A SOAP service?? SOAP服务? I think that you're not handling the exception in the service, so you're getting the default response from IIS, which is a web page. 我认为您没有在服务中处理异常,因此您从IIS(它是一个网页)获取默认响应。

You should handle the exception in the service and return an object (or XML) containing the exception details. 您应该在服务中处理异常,并返回包含异常详细信息的对象(或XML)。

If it's an invocation error, you should try to custom handle incoming requests on the service. 如果是调用错误,则应尝试自定义处理服务上的传入请求。

Or maybe this could help Specified argument was out of the range of valid values. 也许这可以帮助指定的参数超出有效值范围。 Parameter name: site 参数名称:site

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM