【问题标题】:Error communicating with WCF WPF app hosted in Windows Service与 Windows 服务中托管的 WCF WPF 应用程序通信时出错
【发布时间】:2011-01-12 20:07:34
【问题描述】:

当有两台不同的机器访问同一个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
=+=+=+=+=+=+=+=+=+=+=+=+

【问题讨论】:

  • 我看不懂西班牙语,但是我可以告诉你,WCF 在遇到问题时会抛出一般错误,并且给出的错误消息通常并不指向实际问题。我们可能需要比错误消息更详细的信息来帮助您解决这个问题(最好是英文)
  • 我认为是葡萄牙语。看起来像套接字超时。仔细检查地址和/或尝试将调试器附加到服务器。

标签: wpf wcf windows-services


【解决方案1】:

在我看来,您遇到了超时异常。尝试增加服务的超时选项。

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

【讨论】:

  • 只有在第二台机器尝试使用该应用程序时才会出现此问题。一旦第二台机器访问公共方法。只涉及一台机器时运行正常。
  • 好的。出现问题是因为我在服务器端使用了一个静态属性来进行验证。我将尝试使用应用程序的用户和密码更改哈希表的验证。我打算将其放入内存中,以提高性能。有人有什么建议吗?
猜你喜欢
  • 1970-01-01
  • 2018-05-17
  • 2017-01-20
  • 2011-10-05
  • 2012-03-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-06
相关资源
最近更新 更多