我正在使用EF创建WCF服务,并且具有带有数据批注的部分类以进行验证。但是从服务方法返回值时出现错误。如果我没有局部类而直接使用EF类,那么它会起作用。请帮忙。
错误:
远程主机强行关闭了现有连接
错误消息:
在收到HTTP响应时发生错误 http://localhost/Services/AppService.svc。这可能是由于服务 端点绑定不使用HTTP协议。这也可能是由于 HTTP请求上下文被服务器中止(可能是由于 服务关闭)。有关更多详细信息,请参阅服务器日志。
内部异常:
{System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: 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)
--- End of inner exception stack trace ---
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)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)}