SaravananArumugam
SaravananArumugam

Reputation: 3720

Two Bindings for the same contract

I have a contract for which i have an basicHttpBinding.

            <endpoint address="http://localhost:49654/BookShopService.svc" binding="basicHttpBinding" contract="BookShop.IBookShopService">
            </endpoint>

I want to add another endpoint with wsHttpBinding, for the same binding. What are the steps I have to take? What would be the resulting address?

Upvotes: 0

Views: 230

Answers (2)

Kirk Broadhurst
Kirk Broadhurst

Reputation: 28718

If you are running in IIS, then you shouldn't supply a fully qualified address - the address will be determined by IIS and so supply one can cause deployment problems. So, using Greg Sansom's answer as a foundation, I'd suggest

<endpoint address="" 
    binding="basicHttpBinding" 
    contract="BookShop.IBookShopService" /> 
<endpoint address="ws" 
    binding="wsHttpBinding" 
    contract="BookShop.IBookShopService" />

where ws is a relative addresses to the service location.

e.g.

Upvotes: 1

Greg Sansom
Greg Sansom

Reputation: 20840

Just add another endpoint with a different address, it should look like this:

<endpoint address="http://localhost:49654/BookShopService.svc" binding="basicHttpBinding" contract="BookShop.IBookShopService">
</endpoint>
<endpoint address="http://localhost:49654/BookShopServiceWS" binding="wsHttpBinding" contract="BookShop.IBookShopService">
</endpoint>

There is a primer on MSDN.

Upvotes: 2

Related Questions