Help with exception when deploy .net remoting application over internet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • a amns
    New Member
    • Oct 2010
    • 1

    #1

    Help with exception when deploy .net remoting application over internet

    Hi everyone,

    I'm trying to make a .net application works in a computer outside my intranet, using a web service created with .Net remoting and
    hosted in my intranet.

    This application works well in any computer in the intranet, but not in the computer
    that accesses the web service over the internet.

    My .net remoting web service is configured in IIs and uses http channel.

    I'm using interfaces and i'm implementing this interfaces each one
    being a subclass of the MarshalByRefObj ect, like this:

    Code:
            public interface IClassMain
            {
                int GetSum(int a, int b);
                IClass1 Class1 { get; }
            }
    
            public interface IClass1
            {
                String GetFormattedName(string firstname, string lastname);
            }
    
            internal class ClassMainImplementation : MarshalByRefObject, IClassMain
            {
                private Class1Implementation m_class1Implementation;
    
                public ClassMainImplementation()
                {
                    m_class1Implementation = new Class1Implementation(ConfigurationManager.AppSettings.Get("CONNECTION_STRING"), this);
                }
    
                public IClass1 Class1
                {
                    get { return m_class1Implementation; }
                }
    
                public int GetSum(int a, int b)
                {
                    return a + b;
                }
    
            }
    
            internal class Class1Implementation : MarshalByRefObject, IClass1
            {
                private ClassMainImplementation m_classMainImplementation;
                private string m_conn_str;
    
                public Class1Implementation(string con_str, ClassMainImplementation classMainImplementation)
                {
                    m_classMainImplementation = classMainImplementation;
                    m_conn_str = con_str;
                }
    
                public String GetFormattedName(string firstname, string lastname)
                {
                    return firstname + " " + lastname;
                }
    
            }
    In my application, the connection to the server looks like this:
    HttpChannel ch = new HttpChannel();
    ChannelServices .RegisterChanne l(ch, true);

    IClassMain iClassMain= (IClassMain)Act ivator.GetObjec t(typeof(IClass Main), serverUrl);

    If i call a method from the IClassMAin it works well as expected, but if i call a method from IClass1
    it gives me an exception in the internet. (in the intranet works well)
    The thing is that i have the code organized in several interfaces and i do not want
    to place all code in the same interface and implementation.

    So,
    m_classMainImpl ementation.GetS um(1,2) -» works well in intranet and internet
    m_classMainImpl ementation.Clas s1.GetFormatted Name(name1,name 2) » over the internet returns an exception (only works well in intranet)

    The exception is something like this:
    A connection attempt failed because the connected party did not properly respond after
    a period of time, or established connection failed because connected host has failed to respond [ip]:80

    Server stack trace:
    em System.Net.Http WebRequest.GetR equestStream(Tr ansportContext& context)
    em System.Net.Http WebRequest.GetR equestStream()
    em System.Runtime. Remoting.Channe ls.Http.HttpCli entTransportSin k.ProcessAndSen d(...
    em System.Runtime. Remoting.Channe ls.Http.HttpCli entTransportSin k.ProcessMessag e(...
    em System.Runtime. Remoting.Channe ls.SoapClientFo rmatterSink.Syn cProcessMessage (IMessage msg)

    [InnerExceptionT ype]
    System.Net.Sock ets.SocketExcep tion

    [InnerStackTrace]
    em System.Net.Sock ets.Socket.DoCo nnect(...
    em System.Net.Sock ets.Socket.Inte rnalConnect(...
    em System.Net.Serv icePoint.Connec tSocketInternal (...

    My web.config file is configured like this:
    Code:
      <system.runtime.remoting>
        <customErrors mode="off" />
        <application>
          <service>
            <wellknown
              mode="Singleton"
              objectUri="MainClass.rem"
              type="MainClassIMplementation, MainClass" />
          </service>
          <channels>
            <channel ref="http" />
          </channels>
        </application>
      </system.runtime.remoting>

    I really need to make this web service available and functional over the internet.
    I've spend hours searching in the internet but couldn´t solve my problem yet.
    If anyone could help me i appreciate.

    Thanks.
Working...