Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
NET TCP/HTTP WCF托管在IIS中_Wcf_Iis_Endpoint_Net.tcp - Fatal编程技术网

NET TCP/HTTP WCF托管在IIS中

NET TCP/HTTP WCF托管在IIS中,wcf,iis,endpoint,net.tcp,Wcf,Iis,Endpoint,Net.tcp,我不熟悉WCF和IIS,但一直在阅读如何在IIS中托管WCF应用程序。我们有一个系统,我们正试图部署到IIS,它需要HTTP和NET.TCP端点。我在随机教程中看到了所有配置,但仍然无法从客户端连接。任何有关配置的帮助都将不胜感激 我的WCF目录中的我的EdWCF.svc文件: < %@ ServiceHost Language="C#" Debug="true" Service="TwoFour.WCF.Engine.EdWCF" % > My Web.Config:

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

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

< %@ ServiceHost Language="C#" Debug="true" Service="TwoFour.WCF.Engine.EdWCF" % >
<%@ServiceHost Language=“C#”Debug=“true”Service=“twofur.WCF.Engine.EdWCF”%%>
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>

谢谢你的帮助和建议

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

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

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

    <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>
    
    
    
    感谢您的快速回复。我已经启用了绑定,我只是将主机基址添加到配置文件中,其中baseAddress=“net”。tcp://localhost:12345/EdWCF.svc“-仍然无法连接。您需要添加完整地址。如果EdWCF.svc位于Engine文件夹中,请将其更改为net。tcp://localhost:12345/Engine/EdWCF.svcI 将IIS应用程序的物理路径设置为EdWCF.svc文件所在的C:\User\WCF\WCF。我调整了基址,使之有了网络。tcp://localhost:12345/WCF/EdWCF.svc 但当我尝试从我们的客户端连接时,我仍然得到:无法连接到网络。tcp://localhost:12345/WCF/EdWCF.svc. 连接尝试持续的时间跨度为00:00:02.0052005。TCP错误代码10061:无法建立连接,因为目标计算机主动拒绝连接127.0.0.1:12345。非常感谢您抽出时间尝试并帮助我解决此问题。我非常感激。不幸的是,我仍然没有任何运气。我收到相同的“连接被拒绝”错误消息。我更改了配置文件以匹配您发布的配置文件,但由于某些原因,我的连接无法建立。我仔细检查了我的绑定,然后列出了NetTCP,它是一个启用的协议。我不得不删除HttpGetEnabled=“true”,因为它一直说它是一个无法识别的属性,但在我这样做之后,我终于能够连接了。非常感谢你的朋友,你的男人!