我收到以下错误,当我尝试使用远程连接到我的服务器应用程序:
的问题似乎已发生,同时连接到远程服务器: 服务器遇到一个内部错误。欲了解更多信息,请关闭的customErrors服务器的config文件。的
这是对我的服务器应用程序中的code:
的TcpChannel的TcpChannel =新的TcpChannel(999);
MyRemoteObject remObj =新MyRemoteObject(本);
RemotingServices.Marshal(remObjMyUri);
ChannelServices.RegisterChannel(的TcpChannel);
看来工作的第一次,但除非服务器应用程序重新启动的错误。
我猜的东西没有被正确清理,但我不知道是什么的customError还亮着。
在那里我开始任何想法。谢谢你。
- 由于古勒扎尔,我修改了code以上以下,现在的错误显示:
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
的TcpChannel的TcpChannel =新的TcpChannel(999);
MyRemoteObject remObj =新MyRemoteObject(本);
RemotingServices.Marshal(remObjMyUri);
ChannelServices.RegisterChannel(的TcpChannel);
解决方案
对于.NET 1.0 / 1.1,你需要一个配置文件用于远程服务器
如果你没有一个< ServerEXE>的.config
文件,创建一个和它有这样的:
< XML版本=1.0编码=UTF-8&GT?;
<结构>
< system.runtime.remoting>
<的customErrors模式=关/>
< /system.runtime.remoting>
< /结构>
对于.NET 2.0,你可以使用RemotingConfiguration.CustomErrorsMode物业
I getting the following error when I try to connect to my server app using remoting:
A problem seems to have occured whilst connecting to the remote server: Server encountered an internal error. For more information, turn off customErrors in the server's .config file.
This is the code on my server app:
TcpChannel tcpChannel = new TcpChannel(999);
MyRemoteObject remObj = new MyRemoteObject (this);
RemotingServices.Marshal(remObj, "MyUri");
ChannelServices.RegisterChannel(tcpChannel);
It seems to work the first time, but unless the server app is restarted the error occurs.
I would guess something isn't being cleaned up properly but I'm not sure what as the customError is still on.
Any ideas where I start. Thanks.
[EDIT] - Thanks to Gulzar, I modified my code above to the following and now the errors are shown:
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
TcpChannel tcpChannel = new TcpChannel(999);
MyRemoteObject remObj = new MyRemoteObject (this);
RemotingServices.Marshal(remObj, "MyUri");
ChannelServices.RegisterChannel(tcpChannel);
解决方案
For .Net 1.0/1.1 , you need a config file for remoting server
If you don't have a <ServerEXE>.config
file, create one and have this in it:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<customErrors mode="off" />
</system.runtime.remoting>
</configuration>
For .Net 2.0, you can use RemotingConfiguration.CustomErrorsMode property
上一篇:C# - 这可能标记被覆盖的方法,最终被覆、这可、标记、方法
下一篇:无法在R中安装程序包--第&39;行开始,<;!DOCTYPE HTML发布...';格式错误错误、格式、程序包、amp