C# 来自WCF服务的响应不一致
我有一个托管在IIS7中的WCF服务,这个服务只是另一个服务的包装器,所以它所做的就是调用实际的服务,然后返回一个响应,然后传递给客户端。我遇到的问题是,我发送了一个请求,它会返回数据,当我发送另一个请求时,第二个请求会出现以下错误:请您分享一些可能存在问题的信息C# 来自WCF服务的响应不一致,c#,wcf,C#,Wcf,我有一个托管在IIS7中的WCF服务,这个服务只是另一个服务的包装器,所以它所做的就是调用实际的服务,然后返回一个响应,然后传递给客户端。我遇到的问题是,我发送了一个请求,它会返回数据,当我发送另一个请求时,第二个请求会出现以下错误:请您分享一些可能存在问题的信息 <!DOCTYPE html> <html> <head> <title>Specified argument was out of the range of valid val
<!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.<ConvertResponse>d__6.MoveNext() +96
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
System.Web.Http.WebHost.<ProcessRequestAsyncCore>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& completedSynchronously) +155
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> 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)
版本信息:Microsoft.NET Framework版本:4.0.30319;ASP.NET版本:4.0.30319.34274 [ArgumentOutOfRangeException]:指定的参数超出有效值的范围。 参数名称:value 在System.Web.HttpResponse.set_StatusDescription(字符串值)处 位于System.Web.HttpResponseWrapper.set_StatusDescription(字符串值) 位于System.Web.Http.WebHost.HttpControllerHandler.CopyResponseStatusAndHeaders(HttpContextBase、HttpResponseMessage响应) 在System.Web.Http.WebHost.HttpControllerHandler.d__6.MoveNext()中 ---来自引发异常的上一个位置的堆栈结束跟踪--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中 在System.Web.Http.WebHost.HttpControllerHandler.d__0.MoveNext()中 ---来自引发异常的上一个位置的堆栈结束跟踪--- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中 位于System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) 位于System.Web.HttpTaskAsyncHandler.System.Web.IHTTPassynchandler.EndProcessRequest(IAsyncResult结果) 在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()中 在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)
这是休息服务吗?SOAP服务?? 我认为您没有处理服务中的异常,因此您得到的是来自IIS的默认响应,这是一个网页 您应该在服务中处理异常,并返回包含异常详细信息的对象(或XML) 如果是调用错误,您应该尝试自定义处理服务上的传入请求
或者这可能有帮助,这是一项休息服务?SOAP服务?? 我认为您没有处理服务中的异常,因此您得到的是来自IIS的默认响应,这是一个网页 您应该在服务中处理异常,并返回包含异常详细信息的对象(或XML) 如果是调用错误,您应该尝试自定义处理服务上的传入请求
或者,这可能有助于发布生成异常的代码,而不是粘贴错误页面的内容。尝试调试代码,添加异常处理以记录任何异常。由于调用堆栈包含
TaskAwaiter
,因此很可能在没有异常句柄的异步方法中发生错误。请发布生成异常的代码,而不是粘贴错误页面的内容。尝试调试代码,添加异常处理以记录任何异常。由于调用堆栈包含TaskAwaiter
,因此很可能在没有异常句柄的异步方法中发生错误谢谢,这真的很有帮助。谢谢,这真的很有帮助。