开发者

Can a WCF server expose more than one service over the same TCP port?

开发者 https://www.devze.com 2022-12-13 05:33 出处:网络
Can I expose more than one WCF service (interface) over the same port and have a single client connect to both services with different TCP connections?

Can I expose more than one WCF service (interface) over the same port and have a single client connect to both services with different TCP connections?

I need the two services to be i开发者_C百科ndependent of each other, so that the response to an outstanding message on the channel to one service does not get blocked by a call-back from the other service. (Some client)


On the server side there is no problem exposing several WCF interfaces on the same port. For example in IIS you could have 100's of svc files each with it's own interface, on the same port.

On the client side you can create 2 WCF clients, each with it's own channel.

The only problem I see is that you need to be carefull that the second channel does not go out of scope, when the first callback comes in. If the channel goes out of scope, it gets closed, and then the callback has nothing to callback to.

You could also try putting each of the calls on their own thread.


I think the answer is yes, as long as the Address is different, I meant after the same base address you append different subaddress. not sure about my answer.


I'm pretty sure not, once a host is listening on a port, it owns it.Hosting in IIS with WAS would allow multiple services, on a single web server, to be reached via a DNS name and host headers.

0

精彩评论

暂无评论...
验证码 换一张
取 消