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

5

我在这里已经提过类似的问题:无法为 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>

错误信息如下:

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 访问它,但无法使用 "Add Service Reference "选项通过 net.tcp 协议访问。


确保服务器实际上正在运行并侦听该端口。主动拒绝通常意味着那里没有任何侦听。 - BradleyDotNET
@LordTakkera,服务器已经启动运行。我检查了IIS。 - Aishwarya Shiva
1个回答

15

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接