使用IIS 7.5在同一应用程序中托管多个服务

时间:2012-01-22 01:56:25

标签: wcf iis net.tcp

我有一个带有5个WCF服务的Visual Studio解决方案。它们都在同一个项目“MyCompany.MySoftware.Services”中。

这一次,我将它们全部托管在IIS中(我习惯使用Windows服务进行托管,但我计划使用AppFabric,因此我决定更改)并且我已经启用了HTTP和Net.TCP绑定。< / p>

每项服务的配置如下:

<service name="Kipany.Belvedere.Services.Services.AppointmentService"
         behaviorConfiguration="GeneralBehavior">
  <endpoint address="" binding="wsHttpBinding" 
            contract="Company.Software.Services.IService1" 
            name="appointmenthttp"/>
  <endpoint address="" binding="netTcpBinding" 
            bindingConfiguration="netTcpBindingConfig" 
            name="appointmenttcp" 
            contract="Company.Software.Services.IService1"/>
  <endpoint address="mex" binding="mexHttpBinding" 
            contract="IMetadataExchange"/>
</service>

<service name="Kipany.Belvedere.Services.Services.AppointmentService"
         behaviorConfiguration="GeneralBehavior">
  <endpoint address="" binding="wsHttpBinding" 
            contract="Company.Software.Services.IService5" 
            name="appointmenthttp"/>
  <endpoint address="" binding="netTcpBinding" 
            bindingConfiguration="netTcpBindingConfig" 
            name="appointmenttcp" 
            contract="Company.Software.Services.IService5"/>
  <endpoint address="mex" binding="mexHttpBinding" 
            contract="IMetadataExchange"/>
</service>

我在这篇文章中读到,在IIS中托管时,我必须让我的netTcp端点没有地址。现在,我的IIS配置了808端口,所以我知道我的所有服务都在使用这个端口。

问题:

1 - Is this a good architecture to use ? 
2 - Can I face problems with this configuration ? 
3 - What if I want to use every service in a different tcp port ?
4 - The port for tcp binding is configurated in the Default Website but I have the option to fill the 'address' in the endpoint, what happens in this case ? As I have to put ONE port in the Default Website binding, how can I use more than one port in my Web.Config ?
5 - My tcp is using the 808 port but this is my Client's Web.Config:

808端口在哪里?

1 个答案:

答案 0 :(得分:0)

  1. 这个架构很好
  2. 配置中没有任何内在因素会导致您出现问题
  3. TCP使用的端口是在IIS中的站点级别(站点绑定)配置的,因此服务必须位于不同的站点才能使用不同的端口 - 端口和地址的其余部分用于路由请求因此,不同端口上的服务没有固有的优势
  4. 如3中所述 - 一个站点中的所有服务将使用相同的端口
  5. 客户端需要完全限定地址,但在IIS主机中,从IIS配置和.svc文件中推断出服务地址(包括端口)的定义
相关问题