【发布时间】:2014-04-29 01:07:27
【问题描述】:
我已经在这里问过类似的问题:Unable to add service client for a net.tcp WCF service。那个时候问题就解决了。但现在同样的错误出现了。我的 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 访问它,但无法通过 net.tcp 协议使用“添加服务引用”选项访问。
【问题讨论】:
-
确保服务器实际上正在运行并在该端口上侦听。主动拒绝通常意味着那里没有任何东西在听。
-
@LordTakkera 服务器已启动并正在运行。我检查了 IIS。