problem of port for remoted object hosted IIS

Hi there I try to do something, it makes my head in, I try to host a remoted object in IIS(done no problem)

Now I would like IIS to listen to another port than 80 so in web.config I tried :

<configuration>
 <system.runtime.remoting>
  <application>
   <service>
    <wellknown mode="SingleCall" type="Server.Hello, Hello"
                        objectUri="Hello.soap" />
   </service>
  
   <channels>
    <channel ref="http" port="8060">
     <serverProviders>
      <formatter ref="soap"/>
     </serverProviders>
    </channel>
   </channels>

  </application>
 </system.runtime.remoting>
</configuration>

and in Client code I tried :



    public Form1()
        {
        
            InitializeComponent();

            InitializeComponent();
           
        
            HttpClientChannel c = new HttpClientChannel("Nicolas",new SoapClientFormatterSinkProvider());
            ChannelServices.RegisterChannel (c);
        }

private void button1_Click(object sender, System.EventArgs e)
        {
            Hello h = (Hello) Activator.GetObject (typeof (Hello),
                "http://81.65.242.111:8060/IISTest/Hello.soap",
                WellKnownObjectMode.Singleton);
            MessageBox.Show(h.HelloWorld());

        }


 


it fails the error message is :

An unhandled exception of type 'System.Net.WebException' occurred in mscorlib.dll

Additional information: The underlying connection was closed: Unable to connect to the remote server.

So is it or not possible to change of port in configuration files

Thank you
Nicolas





Answer this question

problem of port for remoted object hosted IIS

  • Adamus Turner

    yes, in IIS, right click on the WebSite you have your object running on and select "properties"

    On the "Web Site" tab next to "IP Address" you will see a box that says "Advanced..." click it.  For each port you want to add to expose this remote object on, click "Add...", set your ip address (or All Unassigned), the port you want it on.

    This is for Windows 2003 (IIS 6.0), I would assume XP's 5.0 is similar.
    Hope this helps!

  • JuniorBR

    Hi,

    Your client code is ok, but you cannot specify a port inside the Web.config file, if your application is IIS-hosted.
    When your application is IIS-hosted, it inherits IIS' port, so you shouldn't specify the "port" attribute in the .config file. Remove it, and make the configuration changes people before me advised you to make (that is, force your IIS server to listen on 8060 port, not 80).

    Bye.



  • Dinesh Singh Bisht

    You need to make this change in IIS config.
  • problem of port for remoted object hosted IIS