我有一个通过.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远程处理在服务和用户应用程序之间进行通信?
有没有人见过这个?
答案 0 :(得分:0)
我从来没有想出过这个决议。但是我没有使用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>