IIS中托管的NET TCP/HTTP WCF

Fra*_*tta 7 iis wcf endpoint net.tcp

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

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

< %@ ServiceHost Language="C#" Debug="true" Service="TwoFour.WCF.Engine.EdWCF" % >
Run Code Online (Sandbox Code Playgroud)

我的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>
Run Code Online (Sandbox Code Playgroud)

感谢您的任何帮助或建议!

Van*_*dze 13

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

  2. 在站点绑定中添加net.tcp绑定(编辑绑定 - >添加 - >选择类型为net.tcp并添加类似此12345的端口:*)

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

<system.serviceModel>
 <services>
     <host>
       <baseAddresses>
         <add baseAddress="net.tcp://server:12345/ServiceAddress.svc"/>
       </baseAddresses>
     </host>
     ...
 </service>
     ...
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

编辑:

试试这个

<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>
Run Code Online (Sandbox Code Playgroud)