2011-09-20 174 views
1

我创建了一个窗口服务和注册我的ServerRemoteObject就可以在本地计算机中,我的客户端应用程序连接到sSrverRemoteObject其他计算机上并运行在本地主机罚款(我的电脑在LAN上)。但是,当我在我的SERVERHOST与Global.asax的仿真窗口服务并注册该RemoteObject,当我的客户端应用程序连接到RemoteServerObject我收到此错误:在Global.asax中NET远程处理和无法连接到远程服务器的客户端

Error:"Unable to connect to the remote server"

“的Application_Start”我SERVERHOST:

protected void Application_Start(object sender, EventArgs e) 
     { 
      HttpChannel channel = new HttpChannel(9988); 
      ChannelServices.RegisterChannel(channel, false); 
      RemotingConfiguration.ApplicationName = "Proxy"; 
      RemotingConfiguration.RegisterWellKnownServiceType(typeof(ServerRemoteObject), 
       "Server", 
       WellKnownObjectMode.Singleton); 
     } 

客户端应用程序代码连接ServerRemoteObject:

Library.IServer serverInstance = (Library.IServer)Activator.GetObject(typeof(Library.IServer), "http://hadeli.somee.com:9988/Proxy/Server"); 
            byte[] bytesRemotibg = serverInstance.Encrypt(GetRequseUrl(value)); 
            byte[] resultProcessRemoting = serverInstance.ProcessToRunning(bytesRemotibg); 
+0

你能够从你的服务器ping通hadeli.somee.com?你能看到9988端口吗? – onof

+0

http://support.microsoft.com/kb/323490 –

+0

ONOF:我在http://yougetsignal.com/tools/open-ports网站测试服务器开放的端口,但9988在我访问的close.on我的主人只端口80,21打开。 –

回答

0

我会赶上在客户端异常,并确保您AR e从中获取所有信息(理想情况下记录到日志中)。内部异常或堆栈跟踪应指示您的客户端是否被允许连接到端点(包括端口)或服务器是否失败。您还应该在服务器中记录任何异常。

第一步是确保尽可能多的信息。