[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Yet another "channel tcp is already registered" issue

Gary A. Bushey [MVP]

9/20/2004 5:34:00 PM

I am using a SharePoint Web Part to call a .Net remote object hosting in a
Windows Service. The first time I call this, everything works fine.
Additional calls result in the dreaded "The channel tcp is already
registered". This occurs if I refresh the page that had the successful call
or if I open another browser window and go to the page that hosts the web
part. Any ideas? My code is below:

TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
Calculator calc = new Calculator();
if (calc == null)
{
returnRole = "Could not locate server";
}
else
{
returnRole = calc.Add(21,21).ToString();
}

--
Gary A. Bushey
SPS MVP
bushey@mindspring.com


2 Answers

Gary A. Bushey [MVP]

9/20/2004 5:52:00 PM

0

Once I took out:
ChannelServices.RegisterChannel(chan);

Everything works fine.

--
Gary A. Bushey
SPS MVP
bushey@mindspring.com
"Gary A. Bushey [MVP]" <bushey@mindspring.com.REMOVETOSEND> wrote in message
news:esUHXgznEHA.3896@TK2MSFTNGP15.phx.gbl...
>I am using a SharePoint Web Part to call a .Net remote object hosting in a
>Windows Service. The first time I call this, everything works fine.
>Additional calls result in the dreaded "The channel tcp is already
>registered". This occurs if I refresh the page that had the successful
>call or if I open another browser window and go to the page that hosts the
>web part. Any ideas? My code is below:
>
> TcpChannel chan = new TcpChannel();
> ChannelServices.RegisterChannel(chan);
> Calculator calc = new Calculator();
> if (calc == null)
> {
> returnRole = "Could not locate server";
> }
> else
> {
> returnRole = calc.Add(21,21).ToString();
> }
>
> --
> Gary A. Bushey
> SPS MVP
> bushey@mindspring.com
>


Sam Santiago

9/20/2004 10:34:00 PM

0

You have to verify to only register the channel only once. You said that
once you took out that line it worked fine. You must be registering your
channel elsewhere or in the application configuration file. If you don't
provide your channel a name the default is 'tcp' or 'http' depending on the
channel type, so another frequent cause of this error is registering more
then one channel without a name.

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"Gary A. Bushey [MVP]" <bushey@mindspring.com.REMOVETOSEND> wrote in message
news:up2DBqznEHA.628@TK2MSFTNGP10.phx.gbl...
> Once I took out:
> ChannelServices.RegisterChannel(chan);
>
> Everything works fine.
>
> --
> Gary A. Bushey
> SPS MVP
> bushey@mindspring.com
> "Gary A. Bushey [MVP]" <bushey@mindspring.com.REMOVETOSEND> wrote in
message
> news:esUHXgznEHA.3896@TK2MSFTNGP15.phx.gbl...
> >I am using a SharePoint Web Part to call a .Net remote object hosting in
a
> >Windows Service. The first time I call this, everything works fine.
> >Additional calls result in the dreaded "The channel tcp is already
> >registered". This occurs if I refresh the page that had the successful
> >call or if I open another browser window and go to the page that hosts
the
> >web part. Any ideas? My code is below:
> >
> > TcpChannel chan = new TcpChannel();
> > ChannelServices.RegisterChannel(chan);
> > Calculator calc = new Calculator();
> > if (calc == null)
> > {
> > returnRole = "Could not locate server";
> > }
> > else
> > {
> > returnRole = calc.Add(21,21).ToString();
> > }
> >
> > --
> > Gary A. Bushey
> > SPS MVP
> > bushey@mindspring.com
> >
>
>