WindowsFormsApplicationBase 遇 Remoting 报 远程主机强迫关闭了一个现有的连接
2016-09-21 17:27
721 查看
近日软件增加了通过远程对象调用远程对象的方法功能,在我的开发环境很顺利,按部就班完成了调用,测试也顺利通过。但发布到用户电脑上就出现了问题,不是所有电脑都有问题,个别电脑出现了如下错误:远程主机强迫关闭了一个现有的连接,把堆栈输出:
在 System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
....
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
百思不得其解啊,最开始并没想到是WindowsFormsApplicationBase引起的。直到搜索到了老外的一个问答才知道解决办法:
那就是 "priority"属性的作怪,把该属性设置为10就可以了。可能原因是程序默认权限比较低,创建信道时失去了与远程连接的权限,现在把权限提升后,运行正常。
BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientprovider = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = 0;
props["name"] = "client";
props["priority"] = "10";
TcpChannel clientChanel = new TcpChannel(props, clientprovider, provider);
ChannelServices.RegisterChannel(clientChanel, false);
--------------------------------------------------------------------------以下是网络上搜索到的结果--------------------------
Hi,
The TcpChannel created internally is given the default priority. I create
our additional channel with a higher priority, which seems to solve the
problem. I'm not sure this is a proper fix, but it seems to work.
System.Collections.IDictionary properties = new
System.Collections.Hashtable();
properties["name"] = string.Empty;
properties["priority"] = "10";
在 System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
....
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
百思不得其解啊,最开始并没想到是WindowsFormsApplicationBase引起的。直到搜索到了老外的一个问答才知道解决办法:
那就是 "priority"属性的作怪,把该属性设置为10就可以了。可能原因是程序默认权限比较低,创建信道时失去了与远程连接的权限,现在把权限提升后,运行正常。
BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientprovider = new BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = 0;
props["name"] = "client";
props["priority"] = "10";
TcpChannel clientChanel = new TcpChannel(props, clientprovider, provider);
ChannelServices.RegisterChannel(clientChanel, false);
--------------------------------------------------------------------------以下是网络上搜索到的结果--------------------------
Hi,
The TcpChannel created internally is given the default priority. I create
our additional channel with a higher priority, which seems to solve the
problem. I'm not sure this is a proper fix, but it seems to work.
System.Collections.IDictionary properties = new
System.Collections.Hashtable();
properties["name"] = string.Empty;
properties["priority"] = "10";
相关文章推荐
- Windows下的UDP爆了10054--远程主机强迫关闭了一个现有的连接
- WCF分布式开发常见错误(2)无法从传输连接中读取数据: 远程主机强迫关闭了一个现有的连接
- python 远程主机强迫关闭了一个现有的连接 socket 超时设置 errno 10054
- hubbledotnet 远程连接提示:无法从传输连接中读取数据:远程主机强迫关闭一个现有的连接
- myEclipse/eclipse下控制台"DeviceMonitor]Adb connection Error:远程主机强迫关闭了一个现有的连接。"解决办法
- 处理“远程主机强迫关闭了一个现有的连接”
- SQL SERVER 远程主机强迫关闭一个现有连接
- System.Data.SqlClient.SqlException: 在向服务器发送请求时发生传输级错误。 (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有的连接。)
- Eclipse 远程主机强迫关闭了一个现有的连接 问题解决方案
- 在向服务器发送请求时发生传输级错误。 (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有的连接。)
- Adb connection Error:远程主机强迫关闭了一个现有的连接
- Adb connection Error:远程主机强迫关闭了一个现有的连接。Unable to open sync connection!
- Adb connection Error:远程主机强迫关闭了一个现有的连接
- Adb connection Error:远程主机强迫关闭了一个现有的连接
- 远程主机强迫关闭了一个现有的连接。请高手解答?
- 远程主机强迫关闭了一个现有的连接
- 解决:Adb connection Error:远程主机强迫关闭了一个现有的连接
- Adb connection Error:远程主机强迫关闭了一个现有的连接
- 无法从传输连接中读取数据: 远程主机强迫关闭了一个现有的连接。这个错误很难判断错在哪里,刚开……
- 解决:Adb connection Error:远程主机强迫关闭了一个现有的连接