none
.Net Remoting RRS feed

  • Question

  • Hai...

    I was developed a mini Project using .Net Remoting.I have a three projects Client and Server is windows application.Another one is Class Library.Both Projects were developed 4.0 Environment.My mode of the Project is client going to be connect server and can open any exe in server system.exe means like notepad or specific path files.This project was success internal domain.But if i going to run my server exe in windows 2008 Server in another domain then client can't communicate the server.Error is Server has Rejected the client Credentials..

    Here my office created the port between the two domain..so telnet is working fine..but my client cannot coomunicate the Server System..

    Client is Windows 7...

    Server is Windows 8 Server...

    Please if Any one solve this same issue Please help me and give the Solution also..

     Client Side:

    TcpChannel _clientChannel ;

    if (_clientChannel == null)
                                    {
                                        _clientChannel = new TcpChannel();

      ChannelServices.RegisterChannel(_clientChannel, true);

     }

    //Test is My Proxy Class objTest is object of Test..

    objTest = (Test)Activator.GetObject(
                                                typeof(Test),
                                                ipAddr);

     Process p = objTest.StartProcess(processName);//Call the Server Application

    Server Side:

                                                 

    I call this below method in Main.....

      static bool RemoteStart()
            {
                try
                {
                    TcpChannel channel;
                    //TcpChannel channel = new TcpChannel();
                    //channel = new TcpServerChannel(40630);
                    IChannel[] regChannels = ChannelServices.RegisteredChannels;
                    for (int i = 0; i <= regChannels.GetUpperBound(0); i++)
                    {
                        ChannelServices.UnregisterChannel(regChannels[i]);
                    }

                    int remPort = 40630;
                    //int remPort = Convert.ToInt32(txtPort.Text);

                    BinaryServerFormatterSinkProvider serverProvTcp = new BinaryServerFormatterSinkProvider();
                    serverProvTcp.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                    BinaryClientFormatterSinkProvider clientProvTcp = new BinaryClientFormatterSinkProvider();

                    System.Collections.IDictionary propsTcp = new System.Collections.Hashtable();
                    propsTcp["username"] = "Kalas";
                    propsTcp["password"] = "1234";
                    propsTcp["domain"] = " LocalDomain";
                    propsTcp["port"] = remPort;
                    propsTcp["name"] = "Server";

                    channel = new TcpChannel(propsTcp, clientProvTcp, serverProvTcp);
                    //channel.IsSecured = false;

                    ChannelServices.RegisterChannel(channel, true);
                    RemotingConfiguration.RegisterWellKnownServiceType(typeof(CommonDll.Test), "Server", WellKnownObjectMode.Singleton);

                    RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
                    channel.StartListening("Listioning.........");

                }
                catch (ArgumentNullException ex)
                {
                    CLogger.Reference.LogException("ArgumentNullException in RemoteStart() Msg. :- " + ex.Message + " Trace :- " + ex.StackTrace);
                    return false;
                }
                catch (System.Security.SecurityException ex)
                {
                    CLogger.Reference.LogException("SecurityException in RemoteStart() Msg. :- " + ex.Message + " Trace :- " + ex.StackTrace);
                    return false;
                }
                catch (RemotingException ex)
                {
                    CLogger.Reference.LogException("RemotingException in RemoteStart() Msg. :- " + ex.Message + " Trace :- " + ex.StackTrace);
                    return false;
                }
                catch (Exception ex)
                {
                    CLogger.Reference.LogException("Exception in RemoteStart() Msg. :- " + ex.Message + " Trace :- " + ex.StackTrace);
                    return false;
                }
                return true;
            }

    Tuesday, February 18, 2014 6:03 AM