tags:

views:

29

answers:

2

If one needs to expose multiple endpoints (e.g., one with basicHttpBinding, and another with netTcpBinding) for a single contract in a heterogeneous environment, on a WAS-hosted service, how does one do it?

Everything I've read about WAS configuration of endpoints indicates that endpoint addresses and host base addresses should be left blank, because WAS is supposed to automatically resolve addresses via the path to the .svc file and the protocol.

However, it seems impossible to define an HTTP endpoint and a TCP endpoint for the same contract without explicating the addresses. Every attempt of mine thus far has netted me the coveted "a binding instance has already been associated to listen uri" error.

Ideas?

Thanks

A: 

As far as I understand, the *.svc file is only viable for HTTP protocols, e.g. you can use it for your basicHttpBinding connection. In that case, you're absolutely right - the service's base address and the endpoint's address attribute are ignored - the service URI is defined by server name, optionally port, the virtual directory where the SVC file resides, and the name and extension of the SVC file itself.

So as long as you don't need multiple different HTTP-like protocols and endpoints, that one SVC file should take care of the HTTP traffic.

However, these options do not apply to non-http protocols, like netTcpBinding. In that case, you need to define an endpoint address (possibly as a relative path off an appropriate base address) in your web.config.

marc_s
Thanks for responding.If I do not specify the host base address, and configure the endpoint address for the netTcpBinding endpoint in the WAS config file as only "/tcp" and send a request to net.tcp://localhost/MyService/Service.svc/tcp, the request appears to be routed correctly. Also, if I generate a proxy from that configuration, the client address is generated as net.tcp://localhost/MyService/Service.svc/tcp (same addr as before).Those two factors seem to imply that WAS resolves the base address using the protocol and path to the SVC file for TCP bindings.
@User364825: it is my understanding that you need to have an **complete** address in your endpoint, or if you want to use a relative address like "/tcp", you **must** have a base address
marc_s
+1  A: 

See if this works for you http://knowledgebaseworld.blogspot.com/2010/06/domain-name-replaced-with-machine-name.html I was hainvg same issue of "a binding instance has already been associated to listen uri" which get fixed by adding httpGetUrl along with binding address

IBhadelia