0

我可以在客户端和服务器之间建立远程通信,但是每次客户端调用客户端激活远程对象上的方法时,我都会收到 System.Net.WebException:

{"The underlying connection was closed: An unexpected error occurred on a receive."}

There is a System.IO.IOException INnerException
{"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."}

The stack trace is this:

"\r\nServer stack trace: \r\n   
at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.ProcessResponseException(WebException webException, HttpWebResponse& response)\r\n   
at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)\r\n   
at System.Runtime.Remoting.Channels.SoapClientFormatterSink.SyncProcessMessage(IMessage msg)\r\n\r\n
Exception rethrown at [0]: \r\n   
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n   
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n   
at Remoting.Example.DoSomething() ....
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   
at System.Threading.ThreadHelper.ThreadStart()"
4

1 回答 1

0

无论如何,当我将服务器和客户端上的通道从 http 更改为 tcp 时,问题就解决了。

于 2012-10-28T19:26:00.690 回答