接收 HTTP 响应时出现 WCF 服务错误
WCF service error while recieving the HTTP response
我在生产环境中收到响应时遇到错误。但同样的方法在测试环境中运行良好。
An error occurred while receiving the HTTP response to
http://localhost:54544/Services/XXX.svc. This could be due to
the service endpoint binding not using the HTTP protocol. This could
also be due to an HTTP request context being aborted by the server
(possibly due to the service shutting down). See server logs for more
details.
如果我在生产环境中使用测试数据库服务器,那么它运行得非常好
完整错误的堆栈跟踪是
Server stack trace: at
System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException
webException, HttpWebRequest request, HttpAbortReason abortReason)
at
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) at
System.ServiceModel.Channels.RequestChannel.Request(Message message,
TimeSpan timeout) at
System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
message, TimeSpan timeout) at
System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins,
Object[] outs, TimeSpan timeout) at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at
Common.Infrastructure.Impl.SubService.ISubscription.GetProductLicensesByUser(String
userId) at
Common.Infrastructure.Impl.X.Y.Z(String
userId) in
C:\Users\XXX\Source\Repos\XXX\Src\Common.Infrastructure.Impl\Service
References\XXXX\Reference.cs:line 10303 at
Common.Infrastructure.Impl.X.Y(String
userGuid) in
C:\Users\XXXX\Source\Repos\XXX\XXXX\Common.Infrastructure.Impl\X.cs:line
1286 at
Common.Infrastructure.Impl.X.Y(String
userGuid) in
C:\Users\XXXX\Source\Repos\XX\XX\Common.Infrastructure.Impl\XX.cs:line
1274
通过检查 WCF 服务日志解决
问题是我有一个枚举并且我将枚举值存储在数据库中。现在该枚举的索引已更改,因此当我从数据库中获取值并将数据库值再次转换为枚举时,它会给我一个错误。在测试环境中,所有数据库值在枚举中都有映射,这就是为什么在测试环境中它在获取记录时不会引发错误。
我在生产环境中收到响应时遇到错误。但同样的方法在测试环境中运行良好。
An error occurred while receiving the HTTP response to http://localhost:54544/Services/XXX.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
如果我在生产环境中使用测试数据库服务器,那么它运行得非常好
完整错误的堆栈跟踪是
Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Common.Infrastructure.Impl.SubService.ISubscription.GetProductLicensesByUser(String userId) at Common.Infrastructure.Impl.X.Y.Z(String userId) in C:\Users\XXX\Source\Repos\XXX\Src\Common.Infrastructure.Impl\Service References\XXXX\Reference.cs:line 10303 at Common.Infrastructure.Impl.X.Y(String userGuid) in C:\Users\XXXX\Source\Repos\XXX\XXXX\Common.Infrastructure.Impl\X.cs:line 1286 at Common.Infrastructure.Impl.X.Y(String userGuid) in C:\Users\XXXX\Source\Repos\XX\XX\Common.Infrastructure.Impl\XX.cs:line 1274
通过检查 WCF 服务日志解决
问题是我有一个枚举并且我将枚举值存储在数据库中。现在该枚举的索引已更改,因此当我从数据库中获取值并将数据库值再次转换为枚举时,它会给我一个错误。在测试环境中,所有数据库值在枚举中都有映射,这就是为什么在测试环境中它在获取记录时不会引发错误。