Vista 中的 .net 远程处理

发布于 2024-07-20 07:07:19 字数 1513 浏览 6 评论 0原文

我有一个通过 .net 远程处理与 wndows 服务通信的应用程序。

在 XP 下这一切都很好,但是当我在 Vista 上运行相同的代码时,我得到了异常,

System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8969

Server stack trace: 
   at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(AddressFamily family)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
   at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
   at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

我尝试关闭防火墙,在与登录用户相同的用户上下文中运行该服务,但无济于事。

Vista 中是否存在不允许通过 .net 远程处理在服务和用户应用程序之间进行通信的问题?

还有其他人看过这个吗?

I've got an application that communicates with a wndows service via .net remoting.

Under XP this is all fine but when I run the same code on Vista I get the exception

System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8969

Server stack trace: 
   at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(AddressFamily family)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
   at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
   at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

I've tried turning the firewall off, running the service in the same user context as the user that is logged in to no avail.

Is there something about Vista that doesn't allow communication between services and user applications via .net remoting?

Has anyone else seen this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云胡 2024-07-27 07:07:19

我从来没有为此想出一个解决方案。 但我没有使用 tcp 进行远程处理,而是使用 .net 2.0 附带的 ipc 协议(这是从 1.1 转换而来的项目)。

指定授权组可以解决此问题:

  <system.runtime.remoting>
      <application name="MyService">
        <service>
          <wellknown type="MyAssembly.MyServiceProxy, MyService" objectUri="FrontdeskSyncService.rem"  mode="Singleton" /> 
        </service>
        <channels>
          <channel ref="ipc" portName="server" authorizedGroup="Everyone">
            <serverProviders>
              <formatter ref="binary" typeFilterLevel="Full" />
            </serverProviders>
          </channel>
        </channels>
      </application>
  </system.runtime.remoting>

I never came up with a resolution for this. But instead of using tcp for remoting, I used the ipc protocol that came with .net 2.0 (this was a converted project from 1.1).

Specifying the authorized group got around this issue:

  <system.runtime.remoting>
      <application name="MyService">
        <service>
          <wellknown type="MyAssembly.MyServiceProxy, MyService" objectUri="FrontdeskSyncService.rem"  mode="Singleton" /> 
        </service>
        <channels>
          <channel ref="ipc" portName="server" authorizedGroup="Everyone">
            <serverProviders>
              <formatter ref="binary" typeFilterLevel="Full" />
            </serverProviders>
          </channel>
        </channels>
      </application>
  </system.runtime.remoting>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文