我可以在客户端和服务器之间建立远程通信,但每次客户端调用Client Activated远程对象上的方法时,我都会得到一个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()"
答案 0 :(得分:0)
尽管如此,当我将服务器和客户端上的频道从http更改为tcp时,问题就解决了。