-1

客户有这样的目标地址,如下所示。

<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 位于同一网络上。

这就是为什么我要寻求帮助来帮助我解决这个问题。

4

1 回答 1

1

当您尝试访问另一台计算机时,请更换

http://localhost:8080/ConsoleService/

与另一台机器的网络地址,例如

http://othermachine:8080/ConsoleService/

确保端口号正确。也许是80端口。

于 2013-10-06T20:18:25.943 回答