If you're using IIS/ASP.NET to host your remoting component, then just add
an extra channel element to your web.config and the client configuration
files so that the tcp channel is registered on some port in addition to the
http channel.

For example, here's a sample web.config that supports both http and tcp
channels, while still using the binary formatter for compactness:

<configuration>
  <system.runtime.remoting>
    <application>
      <service>
        <wellknown mode="Singleton" type="Calc, server"
objectUri="calc.soap" />
      </service>

      <channels>
        <channel ref="http">
          <clientProviders>
            <formatter ref="binary" />
          </clientProviders>
          <serverProviders>
            <formatter ref="binary" />
          </serverProviders>
        </channel>

        <channel ref="tcp" port="8080">
          <clientProviders>
            <formatter ref="binary" />
          </clientProviders>
          <serverProviders>
            <formatter ref="binary" />
          </serverProviders>
        </channel>
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>

Notice that the tcp channel will use port 8080, while the http channel will
be left to support calls over port 80 by default.

The client configuration file would look similar, but without the port
designations.  For example, on my machine, calling
ChannelServices.GetUrlsForObject on the server object's this reference
within a method call returns the following two urls:

http://192.168.0.6:80/httptcp/2e1fc5bb_9143_4293_8bec_c17e895add79/calc.soap
tcp://192.168.0.6:8080/2e1fc5bb_9143_4293_8bec_c17e895add79/calc.soap

(where httptcp is the virtual directory I created)

-Mike
http://staff.develop.com/woodring
http://www.develop.com/devresources

----- Original Message -----
From: "Peter Laan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 12, 2002 9:08 AM
Subject: Re: [DOTNET] Remoting on Tcp and Http


> I haven't actually tried it, but I can't see how it could work to have
both
> IIS and a .net exe listening on http:80. I need IIS to listen on port 80
for
> my web site. Perhaps I could have my web site on port 8080. But would
> everyone be able to access it then? Or would some firewalls stop this?
>
> Peter
>
> From: "Srihari Angaluri" <[EMAIL PROTECTED]>
> > Could you not register a HttpChannel and a TcpChannel in your server and
> > listen on both? Pardon me if I misunderstood your question all together
:)
> >
> >         -Srihari
> >
> > On Fri, 12 Apr 2002, Peter Laan wrote:
> >
> > > Is it possible to expose a remoting object on both Tcp (any port) and
> Http
> > > (port 80) while still running a web site from the same server?
> > >
> > > I had this great idea (I thought) that my clients would first try to
> connect
> > > to the singleton object with tcp, and if that didn't work they would
> switch
> > > to Http on port 80. I created a virtual directory on IIS to expose it
on
> > > Http and then I thought I would be able to write a small exe that
would
> get
> > > the object from IIS and then Marshal it on a Tcp channel. But to my
> horror
> > > it didn't work becase all I got back was a proxy, and it seems like
you
> > > can't marshal a proxy. :(
> > >
> > > So, is there any way to accomplish this? Or am I stuck with Http?
> > >
> > >
> > > Peter
> > >
> > > You can read messages from the DOTNET archive, unsubscribe from
DOTNET,
> or
> > > subscribe to other DevelopMentor lists at http://discuss.develop.com.
> > >
> >
> > You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
> > subscribe to other DevelopMentor lists at http://discuss.develop.com.
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to