客户有这样的目标地址,如下所示。
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService1" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8080/ConsoleService/" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService1" contract="ServiceReference1.IService1"
name="WSHttpBinding_IService1">
<identity>
<userPrincipalName value="KIRILL-PC\Кирилл" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
并且服务器具有此配置。
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<services>
<service name ="WcfServiceLibrary1.Service1"
behaviorConfiguration ="ConsoleServiceMEXBehavior">
<endpoint address ="mex"
binding ="mexHttpBinding"
contract ="IMetadataExchange" />
<endpoint address =""
binding ="wsHttpBinding"
contract ="WcfServiceLibrary1.IService1" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/ConsoleService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name ="ConsoleServiceMEXBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
然后我尝试发送smth,程序报错
System.ServiceModel.EndpointNotFoundException
防火墙已禁用,两台 PC 位于同一网络上。
这就是为什么我要寻求帮助来帮助我解决这个问题。