ChannelFactory don't have an address on the endpoint, why?

Posted by Maxim on Stack Overflow See other posts from Stack Overflow or by Maxim
Published on 2008-11-18T00:05:50Z Indexed on 2010/03/21 5:11 UTC
Read the original article Hit count: 464

Filed under:
|
|
|

When I create a new instance of a ChannelFactory:

var factory = new ChannelFactory<IMyService>();

and that I create a new channel, I have an exception saying that the address of the Endpoint is null.

My configuration inside my web.config is as mentioned and everything is as it is supposed to be (especially the address of the endpoint).

If I create a new MyServiceClientBase, it loads all the configuration from my channel factory:

var factoryWithClientBase = new MyServiceClientBase().ChannelFactory;
Console.WriteLine(factoryWithClientBase.Endpoint.Address); //output the configuration inside the web.config


var factoryWithChannelFactory = new ChannelFactory<IMyService>();
Console.WriteLine(factoryWithChannelFactory.Endpoint.Address); //output nothing (null)

Why?

© Stack Overflow or respective owner

Related posts about wcf

Related posts about c#3.0