如何确定远程通道是否已注册
在我的 ASP.NET 应用程序中,全局应用程序启动事件中有一行通过调用 RemotingConfiguration.Configure() 来配置客户端远程处理通道。
这第一次运行良好,但是当我的 Web 应用程序被回收时,应用程序启动事件再次被触发,导致以下远程异常:
远程配置失败,出现异常“System.Runtime.Remoting.RemotingException:通道“tcp”已经存在挂号的。
我想检测通道是否已配置,以便我可以避免出现此异常。
In my ASP.NET application, I have a line in the global application start event that configures the client remoting channel by calling RemotingConfiguration.Configure().
This works well the first time, but when my web application gets recycled, the application start event is fired again causing the following remoting exception:
Remoting configuration failed with the exception 'System.Runtime.Remoting.RemotingException: The channel 'tcp' is already registered.
I would like to detect if the channel is already configured so that I can avoid getting this exception.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试 ChannelServices.RegisteredChannels
http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.channelservices.registeredchannels(VS.71).aspx
Try ChannelServices.RegisteredChannels
http://msdn.microsoft.com/en-us/library/system.runtime.remoting.channels.channelservices.registeredchannels(VS.71).aspx
我也一直遇到这个问题。
问题是您可以停止调用 RemotingConfiguration.Configure() 的应用程序,但这不会使通道可用。 我不确定它与端口有关,或者可能只是通道的名称。
我发现似乎有效的解决方案是获取已注册的频道并取消注册要删除的频道。
这是一些代码,
我希望这对你有用,对我也有用
I've been having this problem too.
The trouble is that you can stop the application that called RemotingConfiguration.Configure() but that doesn't make the channel available. Its something to do with ports or it might just be the name of the channel, I'm not sure.
The solution I found which seems to work is to get the registered channels and unregister the channel you want to remove.
Here is some code
I hope this works for you, it has for me
但如果你发现它已经被注册了,你会怎么做?
无论如何,我只是想确保您知道 .NET Remoting 已被弃用,取而代之的是 WCF。
But what would you do if you found it was already registered?
In any case, I just wanted to make sure you knew that .NET Remoting has been deprecated in favor of WCF.