0

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

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

每个服务的配置如下:

<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 - 这是一个很好的架构吗?
2 - 我可以面对这个配置的问题吗?
3 - 如果我想在不同的 tcp 端口中使用每个服务怎么办?
4 - tcp 绑定的端口是在默认网站中配置的,但我可以选择在端点中填写“地址”,在这种情况下会发生什么?由于我必须在默认网站绑定中放置一个端口,我如何在我的 Web.Config 中使用多个端口?
5 - 我的 tcp 使用 808 端口,但这是我客户端的 Web.Config:

808端口在哪里?

4

1 回答 1

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