大家好,实际上它上周正在运作,但我不知道发生了什么,现在它无法正常工作。
问题是我在不同的机器上有两个解决方案。第一个有2个项目,一个是WCF服务项目,另一个是wpf项目,它使用这个localhost服务并且工作正常。但是当其他机器想要连接非本地主机的服务器时,它会出现此错误。
下载时出错 '(地址):8732 / Design_Time_Addresses / WcfServiceLibrary1 /服务1 / _vti_bin / ListData.svc / $元数据'。 无法连接到远程服务器无法建立连接 因为目标机器主动拒绝它(地址):8732元数据 包含无法解析的引用: '(地址):8732 / Design_Time_Addresses / WcfServiceLibrary1 /服务1'。 没有端点在听 (地址):8732 / Design_Time_Addresses / WcfServiceLibrary1 / Service1 可以接受这个消息。这通常是由错误的地址引起的 或SOAP动作。有关更多详细信息,请参阅InnerException(如果存在)。 无法连接到远程服务器无法建立连接 因为目标机器主动拒绝它(地址):8732如果 服务在当前解决方案中定义,尝试构建解决方案 并再次添加服务参考。
我已经ping了我的地址,它发送和接收数据 我关掉了Windows防火墙
我的app.config就像这样
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
<binding name="WSHttpBinding_IService11" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="ServiceReference1.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService11"
contract="ServiceReference2.IService1" name="WSHttpBinding_IService11">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
答案 0 :(得分:3)
为什么在客户端上使用完全相同的地址定义了两次相同的端点?
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
contract="ServiceReference1.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService11"
contract="ServiceReference2.IService1" name="WSHttpBinding_IService11">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>