Groups | Blog | Home
all groups > dotnet remoting > august 2003 >

dotnet remoting : HttpChannels registering different ports are conflicting in the same app


Vineet Singla
8/18/2003 1:27:46 PM
Hi,
I am registering 2 HttpChannels in the same app, one without a custom
provider and one with. The first channel that has no custom provider
overrides the second one and does not let the custom sink be part of the
second channel. They are both registering different ports in the same
application and are also named differently. The only way I could make this
work is by turning one of them to be a Tcp channel. Does anyone have an
answer to this problem?

thanks,
vineet

Vineet Singla
8/19/2003 12:00:35 PM
Here is the sample code that I tried:

//Channel 1
ListDictionary channel1Prop =3D new ListDictionary();
channel1Prop.Add("port", 5555);
channel1Prop.Add("name", "channel1");
HttpChannel channel1 =3D new HttpChannel(channel1Prop, null, null);
ChannelServices.RegisterChannel(channel1);

//Channel 2
ListDictionary channel2Prop =3D new ListDictionary();
channel2Prop.Add("name", "channel2");

BinaryClientFormatterSinkProvider binaryProvider =3D new =
BinaryClientFormatterSinkProvider();
MyCustomClientChannelSinkProvider customClientProvider =3D new =
MyCustomClientChannelSinkProvider();
binaryProvider.Next =3D customClientProvider;

HttpChannel channel2 =3D new HttpChannel(channel2Prop, binaryProvider, =
null);
ChannelServices.RegisterChannel(channel2);


Please advise why the second channel would not configure with a custom =
sink provider.

thanks again,
vineet




[quoted text, click to view]
gullit
8/19/2003 10:13:30 PM
I came accross to the same problem,in my web
application,there are more then two pages to call
remoting service.If as least two pages post request at
one time,it will be happened than one will throw
exception ,channel has been registed.
[quoted text, click to view]
gullit
8/19/2003 11:09:28 PM
I have resolve this problem.
Sample code is:

BinaryClientFormatterSinkProvider mysinkprovider = new
BinaryClientFormatterSinkProvider();
TcpClientChannel tcc = new TcpClientChannel
("channel_1",mysinkprovider);
ChannelServices.RegisterChannel(tcc);

//do something
.......

ChannelServices.UnregisterChannel(tcc);

Now my web application can support at least two pages to
call remoting service at one time!
(I do test:2 and 3 pages call remoting service at one
time,no exception has been thrown.)
You can try it!

[quoted text, click to view]
Ingo Rammer
8/20/2003 12:22:35 PM
Even though this might work, I'd acutally recommend a different approach
like the one presented at
http://www.ingorammer.com/RemotingFAQ/REGISTER_HOW_MANY_CHANNELS.html

You might otherwise run into problems when more than one user calls your
ASPX page at the same time.

Cheers,
-Ingo

Independent .NET and Web Services Consultant
Author of "Advanced .NET Remoting"
Microsoft Regional Director - Austria
http://www.ingorammer.com

Read my "Distributed .NET Newsletter" at http://www.ingorammer.com/NL


[quoted text, click to view]

gullit
8/21/2003 1:44:48 AM
Ingo,you are right,thanks a lot!

[quoted text, click to view]
gullit
8/21/2003 1:51:42 AM
Ingo,by the way,can you tell me what does it mean?

props["clientConnectionLimit"] = 0;

this means connection number is unlimited?

[quoted text, click to view]
Vineet Singla
8/21/2003 2:49:28 PM
Ingo, your approach did give some insight on the Channel architecture.
However, if you look at my code, the first channel is for a server and the
second one is for a client. These are completely separate components in the
same app. The problem is that in both the cases we need HttpChannels and
only one uses the custom provider. How can I isolate them. Is appdomain a
solution to it? Can you tell me how to register a client and server channels
in different appdomains?

vineet


"Ingo Rammer"
<PLEASE_DONT_EMAIL_QUESTIONS____ASK_HERE_INSTEAD@ingorammer.com> wrote in
message news:ulsgAQwZDHA.2572@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button