简体   繁体   English

在Windows服务中托管多个Wcf服务

[英]Hosting multiple Wcf services in windows service

I have multiple WCF service to host in windows service. 我有多个WCF服务托管在Windows服务中。
I was wondering, is there a need to create multiple threads for ServiceHost ? 我想知道,是否需要为ServiceHost创建多个线程?
What do I need to consider when hosting these services ? 托管这些服务时需要考虑什么?
For example: 例如:
Does one client blocks another ? 一个客户会阻止另一个吗?
If one client fails does it effects on other ? 如果一个客户端失败,对其他客户端有影响吗? If one client has been throttled, will it throttle the other two ? 如果一个客户端受到限制,它将限制其他两个客户端吗?

ServiceHost creates its own listen thread for every instance so it's perfectly fine to have more than one in one host. ServiceHost为每个实例创建自己的侦听线程,因此在一个主机中拥有多个主机是完全可以的。

For instance we have a service with 4 hosts here. 例如,我们在这里有4个主机的服务。

private ServiceHost _msp;
private ServiceHost _ps;
private ServiceHost _tt;
private ServiceHost _tts;

Windows also has a service running called "Net.Tcp Port Sharing Service". Windows还具有运行的服务,称为“ Net.Tcp端口共享服务”。 This way the hosts can even share the same port when running over tcp. 这样,主机在tcp上运行时甚至可以共享同一端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM