WCF: Unable to open IChannelListener

J

Jon Davis

Newbie to WCF here. I am getting the error "unable to open its
IChannelListener", but the service is running as an admin, and on a
different port from anything else. If it matters, I'm trying to run multiple
instances
of the same service name on different schemes/ports, so that WAN users can
use
HTTP/SOAP, LAN users can use TCP, and localhost users can use named pipes.
Apparently, this isn't doable. I suspect a service name conflict? Since the
service name is the fully qualified classname w/ namespace, do I create a
whole new service class for each scheme?

Some sample code below. Only works when I comment out all but the http bits.
Fails otherwise on tcpServiceHost.Open(); regarding the HTTP uri
http://localhost:8080/Bleah/Admin (weird?!).

---------------

internal static ServiceHost httpServiceHost = null;
internal static ServiceHost tcpServiceHost = null;
internal static ServiceHost pipeServiceHost = null;

internal static void StartService()
{
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
Uri baseAddress = new Uri("http://localhost:8080/Bleah/Admin");

// Instantiate new ServiceHost
httpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
httpServiceHost.Open();

// tcp service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.tcp://localhost:2062/Bleah/Admin");
tcpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
tcpServiceHost.Open();

// pipes service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.pipe://localhost/Bleah/Admin");
pipeServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
pipeServiceHost.Open();

}

....
<service name="BleahAdminService" behaviorConfiguration="returnFaultsHttp">
<!--<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="true" />-->
<endpoint contract="BleahIAdminService"
binding="wsHttpBinding"
address="http://localhost:8080/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netTcpBinding"
address="net.tcp://localhost:2060/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netNamedPipeBinding"
address="net.pipe://localhost/Bleah/Admin" />
</service>


Jon
 
N

Nicholas Paldino [.NET/C# MVP]

Jon,

You have defined one service with three endpoints, but you are trying to
open the service host three times (and subsequently expose the same
endpoints over again). You only need to open the service host once. Also,
you don't need to set the base address, since you have full addresses in
your config file.
 
J

Jon Davis

I played with this for two or three hours yesterday. I realized what you are
saying, but doing it as you described (open it once, without a base address
in the constructor, but leave the base addresses in the config file), the
listeners were NOT active.

Jon

Nicholas Paldino said:
Jon,

You have defined one service with three endpoints, but you are trying
to open the service host three times (and subsequently expose the same
endpoints over again). You only need to open the service host once.
Also, you don't need to set the base address, since you have full
addresses in your config file.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jon Davis said:
Newbie to WCF here. I am getting the error "unable to open its
IChannelListener", but the service is running as an admin, and on a
different port from anything else. If it matters, I'm trying to run
multiple instances
of the same service name on different schemes/ports, so that WAN users
can use
HTTP/SOAP, LAN users can use TCP, and localhost users can use named
pipes.
Apparently, this isn't doable. I suspect a service name conflict? Since
the
service name is the fully qualified classname w/ namespace, do I create a
whole new service class for each scheme?

Some sample code below. Only works when I comment out all but the http
bits.
Fails otherwise on tcpServiceHost.Open(); regarding the HTTP uri
http://localhost:8080/Bleah/Admin (weird?!).

---------------

internal static ServiceHost httpServiceHost = null;
internal static ServiceHost tcpServiceHost = null;
internal static ServiceHost pipeServiceHost = null;

internal static void StartService()
{
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
Uri baseAddress = new Uri("http://localhost:8080/Bleah/Admin");

// Instantiate new ServiceHost
httpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
httpServiceHost.Open();

// tcp service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.tcp://localhost:2062/Bleah/Admin");
tcpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
tcpServiceHost.Open();

// pipes service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.pipe://localhost/Bleah/Admin");
pipeServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
pipeServiceHost.Open();

}

...
<service name="BleahAdminService"
behaviorConfiguration="returnFaultsHttp">
<!--<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="true" />-->
<endpoint contract="BleahIAdminService"
binding="wsHttpBinding"
address="http://localhost:8080/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netTcpBinding"
address="net.tcp://localhost:2060/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netNamedPipeBinding"
address="net.pipe://localhost/Bleah/Admin" />
</service>


Jon
 
J

Jon Davis

I seem to have gotten it to work. A good night of sleep, attention to
absolute URIs, and knowing I'm on the right track (i.e. using the config
file solely) and I'm good to go.

Jon


Jon Davis said:
I played with this for two or three hours yesterday. I realized what you
are saying, but doing it as you described (open it once, without a base
address in the constructor, but leave the base addresses in the config
file), the listeners were NOT active.

Jon

Nicholas Paldino said:
Jon,

You have defined one service with three endpoints, but you are trying
to open the service host three times (and subsequently expose the same
endpoints over again). You only need to open the service host once.
Also, you don't need to set the base address, since you have full
addresses in your config file.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jon Davis said:
Newbie to WCF here. I am getting the error "unable to open its
IChannelListener", but the service is running as an admin, and on a
different port from anything else. If it matters, I'm trying to run
multiple instances
of the same service name on different schemes/ports, so that WAN users
can use
HTTP/SOAP, LAN users can use TCP, and localhost users can use named
pipes.
Apparently, this isn't doable. I suspect a service name conflict? Since
the
service name is the fully qualified classname w/ namespace, do I create
a
whole new service class for each scheme?

Some sample code below. Only works when I comment out all but the http
bits.
Fails otherwise on tcpServiceHost.Open(); regarding the HTTP uri
http://localhost:8080/Bleah/Admin (weird?!).

---------------

internal static ServiceHost httpServiceHost = null;
internal static ServiceHost tcpServiceHost = null;
internal static ServiceHost pipeServiceHost = null;

internal static void StartService()
{
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
Uri baseAddress = new Uri("http://localhost:8080/Bleah/Admin");

// Instantiate new ServiceHost
httpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
httpServiceHost.Open();

// tcp service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.tcp://localhost:2062/Bleah/Admin");
tcpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
tcpServiceHost.Open();

// pipes service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.pipe://localhost/Bleah/Admin");
pipeServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
pipeServiceHost.Open();

}

...
<service name="BleahAdminService"
behaviorConfiguration="returnFaultsHttp">
<!--<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="true" />-->
<endpoint contract="BleahIAdminService"
binding="wsHttpBinding"
address="http://localhost:8080/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netTcpBinding"
address="net.tcp://localhost:2060/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netNamedPipeBinding"
address="net.pipe://localhost/Bleah/Admin" />
</service>


Jon
 
K

keimpema

I seem to have gotten it to work. A good night of sleep, attention to
absolute URIs, and knowing I'm on the right track (i.e. using the config
file solely) and I'm good to go.

Jon


I played with this for two or three hours yesterday. I realized what you
are saying, but doing it as you described (openit once, without a base
address in the constructor, but leave the base addresses in the config
file), the listeners were NOT active.

Nicholas Paldino said:
Jon,
You have defined one service with three endpoints, but you are trying
toopenthe service host three times (and subsequently expose the same
endpoints over again). You only need toopenthe service host once.
Also, you don't need to set the base address, since you have full
addresses in your config file.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Newbie to WCF here. I am getting the error "unabletoopenits
IChannelListener", but the service is running as an admin, and on a
different port from anything else. If it matters, I'm trying to run
multiple instances
of the same service name on different schemes/ports, so that WAN users
can use
HTTP/SOAP, LAN users can use TCP, and localhost users can use named
pipes.
Apparently, this isn't doable. I suspect a service name conflict? Since
the
service name is the fully qualified classname w/ namespace, do I create
a
whole new service class for each scheme?
Some sample code below. Only works when I comment out all but the http
bits.
Fails otherwise on tcpServiceHost.Open(); regarding the HTTP uri
http://localhost:8080/Bleah/Admin(weird?!).
---------------
internal static ServiceHost httpServiceHost = null;
internal static ServiceHost tcpServiceHost = null;
internal static ServiceHost pipeServiceHost = null;
internal static void StartService()
{
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
Uri baseAddress = new Uri("http://localhost:8080/Bleah/Admin");
// Instantiate new ServiceHost
httpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
httpServiceHost.Open();
// tcp service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.tcp://localhost:2062/Bleah/Admin");
tcpServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
tcpServiceHost.Open();
// pipes service
// Consider putting the baseAddress in the configuration system
// and getting it here with AppSettings
baseAddress = new Uri("net.pipe://localhost/Bleah/Admin");
pipeServiceHost = new ServiceHost(typeof(AdminService), baseAddress);
pipeServiceHost.Open();
}
...
<service name="BleahAdminService"
behaviorConfiguration="returnFaultsHttp">
<!--<endpoint contract="IMetadataExchange" binding="mexHttpBinding"
address="true" />-->
<endpoint contract="BleahIAdminService"
binding="wsHttpBinding"
address="http://localhost:8080/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netTcpBinding"
address="net.tcp://localhost:2060/Bleah/Admin" />
<endpoint contract="BleahIAdminService"
binding="netNamedPipeBinding"
address="net.pipe://localhost/Bleah/Admin" />
</service>
Jon

Hi,

Would you please shared your solution (code + config) with this group?
I am struggling with a similar problem.

Harmen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top