IIS中托管的NET TCP / HTTP WCF [英] NET TCP/HTTP WCF Hosted in IIS

查看:132
本文介绍了IIS中托管的NET TCP / HTTP WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是WCF和IIS的新手,但他正在阅读有关如何在IIS中托管WCF应用程序的一些内容。我们有一个系统,我们试图部署到IIS,需要HTTP和NET.TCP端点。我在随机教程中看到了所有配置,但我仍然无法从我的客户端连接。任何有关配置的帮助将不胜感激!

I'm new to WCF and IIS but been doing some reading on how to host a WCF application in IIS. We have a system we're trying to deploy to IIS which needs HTTP and NET.TCP endpoints. I have everything configured as I saw in random tutorials but I still can't connect from my client. Any help with the configuration would be greatly appreciated!

我的WCF目录中的我的EdWCF.svc文件:

My EdWCF.svc file in my WCF directory:

< %@ ServiceHost Language="C#" Debug="true" Service="TwoFour.WCF.Engine.EdWCF" % >

我的网站.Config:

My Web.Config:

    <?xml version="1.0"?>
<configuration>
<system.serviceModel>

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyBehaviour">
          <serviceMetadata HttpGetEnabled="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

<service name="TwoFour.WCF.Engine.EdWCF" behaviorConfiguration="MyBehaviour">
       <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:12345/WCF/EdWCF.svc"/>
          </baseAddresses>
       </host>
       <endpoint address=""
                 binding="netTcpBinding"
                 bindingConfiguration="InsecureTcp"
                 contract="TwoFour.WCF.Interface.Shared.IEdWCF" />
       <endpoint address="mexhttp" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>

  <bindings>
            <netTcpBinding>
                <binding name="InsecureTcp" portSharingEnabled="true">
                    <security mode="None" />
                </binding>
            </netTcpBinding>
        </bindings>

</system.serviceModel>

</configuration>

感谢您的帮助或建议!

Thanks for any help or suggestions!

推荐答案


  1. 在IIS中将net.tcp绑定添加到启用的协议列表中(Mange Web站点) - >高级设置 - >启用协议)

  1. In IIS add net.tcp binding into enabled protocols list (Mange Web Site -> Advance Settings -> Enabled Protocols)

在站点绑定中添加net.tcp绑定(编辑绑定 - >添加 - >选择类型为net.tcp和像这样添加端口12345:*)

In Site binding add net.tcp binding (Edit Binding -> Add -> Choose type as net.tcp and add port like this 12345:*)

您还需要在配置中指定基地址:

You also need to specify Base address in your config:

<system.serviceModel>
 <services>
     <host>
       <baseAddresses>
         <add baseAddress="net.tcp://server:12345/ServiceAddress.svc"/>
       </baseAddresses>
     </host>
     ...
 </service>
     ...
</system.serviceModel>

修改:

试试这个

<system.serviceModel>

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyBehaviour">
          <serviceMetadata />
        </behavior>
      </serviceBehaviors>
    </behaviors>

<service name="TwoFour.WCF.Engine.EdWCF" behaviorConfiguration="MyBehaviour">
       <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:12345/WCF/EdWCF.svc"/>
          </baseAddresses>
       </host>
       <endpoint address=""
                 binding="netTcpBinding"
                 bindingConfiguration="InsecureTcp"
                 contract="TwoFour.WCF.Interface.Shared.IEdWCF" />
       <endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>

  <bindings>
            <netTcpBinding>
                <binding name="InsecureTcp" portSharingEnabled="true">
                    <security mode="None" />
                </binding>
            </netTcpBinding>
        </bindings>

</system.serviceModel>

这篇关于IIS中托管的NET TCP / HTTP WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆