I have a WCF service where IGameServices contains:
我有一个WCF服务,其中IGameServices包含:
[ServiceContract]
public interface IGameServices
{
[OperationContract]
DtoReturnedMessage<DtoGame> GetGame(Guid gameId);
}
AdminServices contains:
public class AdminService : IGameServices
{
private readonly BoGame _boGame = new BoGame();
public DtoReturnedMessage<DtoGame> GetGame(Guid gameId)
{
return _boGame.Get(gameId);
}
}
I have that BoGame, which is a class with business logics.
我有BoGame,这是一个有商业逻辑的类。
My config is:
我的配置是:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGameServices" sendTimeout="00:05:00" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:50380/Services/Implementations/AdminService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGameServices"
contract="IGameServices" name="BasicHttpBinding_IGameServices" />
</client>
</system.serviceModel>
When I debug it step-by-step, all the business logics works properly, and throws the exception below when the response should be sent to the client.
当我逐步调试它时,所有业务逻辑都能正常工作,并在响应应发送到客户端时抛出以下异常。
An error occurred while receiving the HTTP response to http://localhost:50380/Services/Implementations/AdminService.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 IGameServices.GetGame(Guid gameId)
at GameServicesClient.GetGame(Guid gameId)
Inner Exception:
The underlying connection was closed: An unexpected error occurred on a receive.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Inner Exception:
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
Inner Exception:
An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
It is weird because I have a method to save some data into the DB, in the same IGameServices, which saves normally and returns the success message as expected.
这很奇怪,因为我有一种方法可以将一些数据保存到DB中,在同一个IGameServices中,它可以正常保存并按预期返回成功消息。
Does any one know what that can be?
有人知道那会是什么吗?
1 个解决方案
#1
0
I solved the problem. The error was too generic, actually. The issue was with build versions of Postsharp not matching.
我解决了这个问题。实际上,这个错误过于通用了。问题是Postsharp的构建版本不匹配。
I found it out by trying to open the services directly on the browser. I removed Postsharp in that project and BANG.
我通过尝试直接在浏览器上打开服务找到了它。我删除了该项目中的Postsharp和BANG。
#1
0
I solved the problem. The error was too generic, actually. The issue was with build versions of Postsharp not matching.
我解决了这个问题。实际上,这个错误过于通用了。问题是Postsharp的构建版本不匹配。
I found it out by trying to open the services directly on the browser. I removed Postsharp in that project and BANG.
我通过尝试直接在浏览器上打开服务找到了它。我删除了该项目中的Postsharp和BANG。