无法使用NET.TCP绑定访问WCF服务

Ais*_*iva 5 .net c# sockets wcf tcp

我在这里已经问了一个类似的问题:无法为net.tcp WCF服务添加服务客户端.那个问题在那个时候解决了.但现在出现同样的错误.我的WCF服务配置与上一个问题的配置相同.我再次在这里发帖子:

<system.serviceModel>
    <services>
      <service name="CoreService.Service1" behaviorConfiguration="beh1">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost/Service1.svc/mex" />
          </baseAddresses>
        </host>
        <endpoint
     binding="netTcpBinding"
     bindingConfiguration="ultra"
     contract="CoreService.IAccountService"/>
        <endpoint
      binding="netTcpBinding"
      bindingConfiguration="ultra"
      contract="CoreService.IBoardService"/>
        <endpoint
      binding="netTcpBinding"
      bindingConfiguration="ultra"
      contract="CoreService.ICategoryService"/>

        <endpoint
                address="mex"
                binding="mexTcpBinding"
                contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="ultra"
             maxBufferPoolSize="2147483647"
             maxBufferSize="2147483647"
             maxReceivedMessageSize="2147483647"
             portSharingEnabled="false"
             transactionFlow="false"
             listenBacklog="2147483647"
             sendTimeout="00:01:00">
          <security mode="None">
            <message clientCredentialType="None"/>
            <transport protectionLevel="None" clientCredentialType="None"/>
          </security>
          <reliableSession enabled="false"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="beh1">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="True" />
          <dataContractSerializer maxItemsInObjectGraph="65536" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

错误是:

无法识别URI前缀.元数据包含无法解析的引用:'net.tcp://localhost/Service1.svc'.无法连接到net.tcp://localhost/Service1.svc.连接尝试持续时间跨度为00:00:02.0051147.TCP错误代码10061:无法建立连接,因为目标计算机主动拒绝它127.0.0.1:808.无法建立连接,因为目标计算机主动拒绝它127.0.0.1:808如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用.

问题解决后,我没有对配置进行任何更改,几天后它又开始显示错误.我尝试了一切但没有任何效果.请帮忙!

更新:我也可以通过浏览器使用HTTP访问它,但无法通过net.tcp协议使用"添加服务引用"选项进行访问.

Ais*_*iva 11

最后借助这个链接:http://rohitguptablog.wordpress.com/2011/06/16/configuring-wcf-service-with-nettcpbinding/,我弄清楚出了什么问题.其实我错过了上面链接的第三步.Net.Tcp服务未运行.

在此输入图像描述