简体   繁体   中英

.Net Remoting and Unable to connect to the remote server in client

I created a Window Service and register my ServerRemoteObject on it in a local computer,my client application is on other computer connecting to sSrverRemoteObject and runs fine in localhost(my computers are on a LAN). But, when i simulation windows service on my ServerHost with global.asax and register the remoteobject,when my client application connect to RemoteServerObject i receive this error:

Error:"Unable to connect to the remote server"

"Application_Start" in global.asax on my 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);
        }

Client Application code to connect 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);

I would catch the exception in the Client and make sure you are getting all the information out of it (ideally to a log). The Inner Exception or the Stack Trace should indicate if your client is allowed to make a connection to the endpoint (including the port) or if the server is failing. You should also log any exceptions in the server as well.

First step is to make sure you have as much information as it practicable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM