65.9K
CodeProject 正在变化。 阅读更多。
Home

在 IIS7 上托管 WCF 服务(netTcpBinding)

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.80/5 (2投票s)

2010年9月25日

CPOL
viewsIcon

22979

 我使用 wsHttpBinding 和 netTcpBinding 托管了我的 WCF 服务。在使用 netTcpBinding 在 IIS 7 上托管时,我考虑了以下事项,

 我使用 wsHttpBinding 和 netTcpBinding 托管了我的 WCF 服务。在使用 netTcpBinding 在 IIS 7 上托管时,我考虑了以下事项,希望对其他人也有帮助。 

要在 IIS7(WAS) 上托管 WCF 服务,Web.Config 应该具有以下配置设置:

    <bindings>
      <netTcpBinding>
        <binding name="tcpbinding" portSharingEnabled="true">
          <security mode="None"></security>
          <!--<security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
            <message clientCredentialType="Windows"/>
          </security>-->
        </binding>
       </netTcpBinding>
    </bindings>
IIS7 上的故障排除。
如果在添加服务引用时抛出以下异常:
Error:

Cannot obtain Metadata from net.tcp://win-2008:9002/Multibinding/Service1.svc
If this is a Windows (R) Communication Foundation service to which you have access,
please check that you have enabled metadata publishing at the specified address.

For help enabling metadata publishing, please refer to the MSDN documentation at 
http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error
URI: net.tcp://win-2008:9002/Multibinding/Service1.svc   
 
Metadata contains a reference that cannot be resolved: 
'net.tcp://win-2008:9002/Multibinding/Service1.svc'.

Could not connect to net.tcp://win-2008:9002/Multibinding/Service1.svc. 
The connection attempt lasted for a time span of 00:00:02.0374439. 
TCP error code 10061: No connection could be made because the target machine 
actively refused it .     
No connection could be made because the target machine actively refused it 
步骤 1: 确保为 net.tcp 启用了以下服务:
a.                Net.Tcp 监听器适配器
b.               Net.Tcp 端口共享服务
     如果没有,则启用并启动这两个服务。
步骤 2: IIS 管理器 -> 选择托管服务 -> 操作窗格 -> 高级设置 ->
           查看启用协议,默认情况下那里有 http 协议,需要用逗号分隔指定 net.tcp
步骤 3: 确保您的应用程序池以经典模式运行
 
 
步骤 4: 右键单击“默认网站” -> 编辑绑定
            确保那里有 net.tcp 协议信息 
 
步骤 5: 检查防火墙,为我们使用的端口创建入站和出站规则。
© . All rights reserved.