我有多个 WCF 项目,我试图在 WinForms 项目中引用它们。当我尝试添加服务引用时,我可以看到几个项目,但一个没有显示并且拒绝让我添加它,即使我手动输入地址也是如此。当我这样做时,我得到:
元数据包含无法解析的引用:“net.tcp://localhost:14007/DispatchPuller/mex”。无法连接到 net.tcp://localhost:14007/DispatchPuller/mex。连接尝试持续了 00:00:01.0062012 的时间跨度。TCP 错误代码 10061:无法建立连接,因为目标机器主动拒绝它 127.0.0.1:14007。无法建立连接,因为目标机器主动拒绝它 127.0.0.1:14007
据我所知,所有服务都以相同的方式设置。这是两个,一个给我错误的顶部:
<system.serviceModel>
<services>
<service name="PASWCFDispatchPuller.DispatchPuller" behaviorConfiguration="tcpbehaviuor">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="" name="nettcpDispatchPuller" contract="PASWCFDispatchPuller.IDispatchPuller">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="mexDispatchPuller" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:12007/DispatchPuller"/>
</baseAddresses>
</host>
</service>
<service name="PASWCFDispatchPuller.StateUpdate" behaviorConfiguration="tcpbehaviuor">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="" name="nettcpStateUpdate" contract="PASWCFDispatchPuller.IStateUpdate">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="mexStateUpdate" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:12007/StateUpdate"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<!--<behavior >-->
<behavior name="tcpbehaviuor">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="false"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
添加对底部服务的引用没有问题。更改顶部端口的端口也无济于事。任何建议,将不胜感激。