gmail user
gmail user

Reputation: 2783

ServiceHost Class constructor

I'm refering the book Microsoft Windows Communication Foundation Step By Step. It says that

If you omit the base address information in the ServiceHost constructor, like this:

ServiceHost productsServiceHost = new ServiceHost(typeof(ProductsServiceImpl));

the WCF runtime will just use the address information specified in the application configuration file, and automatically listen for requests on all configured endpoints.

But when I try to declare the ServiceHost class using VS 2010, it gives only 2 option for ServiceHost class. Both of which need base url. Is above constructor removed in VS 2010 or am I missing something?

Upvotes: 1

Views: 910

Answers (2)

gmail user
gmail user

Reputation: 2783

Figured it out. It was missing the baseAddress element.

Upvotes: 0

bobbymcr
bobbymcr

Reputation: 24167

There are indeed two constructors:

However, note that they both use a params argument for the base addresses. This means it is valid to not pass anything at all.

Upvotes: 6

Related Questions