与Windows服务中托管的WCF WPF应用程序通信时出错

时间:2011-01-12 20:07:34

标签: wpf wcf windows-services

如果有两台不同的计算机访问同一个WCF服务,则出现以下错误:

Exception throw:
=+=+ BASE EXCEPTION:
APLICATION: mscorlib
ERROR: The socket connection was aborted. This may have
caused by an error processing your message, a timeout
reception exceeded by the remote host or by a problem of network resource
underlying. The local socket timeout was '00: 30:00 '.
CALLSTACK:
Server stack trace:
   in
System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32
offset, Int32 size, TimeSpan timeout, Boolean closing)
   in
System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset,
Int32 size, TimeSpan timeout)
   in
System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32
offset, Int32 size, TimeSpan timeout)
   in
System.ServiceModel.Channels.SessionConnectionReader.Receive(TimeSpan timeout)
   in
System.ServiceModel.Channels.SynchronizedMessageSource.Receive(TimeSpan
timeout)
   in
System.ServiceModel.Channels.FramingDuplexSessionChannel.Receive(TimeSpan
timeout)
   in
System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceive(TimeSpan
timeout, Message& message)
   in
System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message,
TimeSpan timeout)
   in
System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway,
ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   in
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation)
   in
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   in
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,
IMessage retMsg)
   in
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
   in
Evolution.WCF.Contract.IMenuService.GetFullMenu(Int32 userId, Int32 softwareId)
   in
Evolution.CompanyPage.MenuVertical.btn_Menu_Click(Object sender,
RoutedEventArgs e) =+=+ INNER EXCEPTION:
APLICATION: System
ERRO: Was forced to cancel an existing connection by remote host
CALLSTACK:   
in System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
   in
System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32
offset, Int32 size, TimeSpan timeout, Boolean closing) END INNER EXCEPTION =+=+
END BASE EXCEPTION =+=+ =+=+=+=+=+=+=+=+=+=+=+=+ END EXCEPTION
=+=+=+=+=+=+=+=+=+=+=+=+

1 个答案:

答案 0 :(得分:0)

在我看来,你有一个超时异常。尝试增加服务的超时选项。

此外,如果您遇到WCF服务端点的安全相关设置问题,有时您可能会遇到此异常。尝试禁用它(用于测试目的),看看你是否仍然遇到问题。有关如何禁用它的更多信息here