WCF服务拒绝错误服务器已拒绝客户端凭据

时间:2014-08-22 07:57:28

标签: c# .net wcf

按照this指南,我尝试使用WCF service在Windows服务中托管TCP。 这在我的计算机上工作正常但是当在同一网络中的其他计算机上安装此服务时出现错误:服务器拒绝了客户端凭据 我尝试禁用防火墙但仍然出现相同的错误(并且服务运行...) 从客户端添加服务引用工作正常并识别该服务。 这是我的app.config文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      <service name="WcfServiceLibrary1.Service1">
        <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
          contract="WcfServiceLibrary1.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
          contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://192.168.0.100:8523/Service1 " />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>

192.168.0.100是服务器计算机的IP地址。

1 个答案:

答案 0 :(得分:0)

尝试使用此配置进行tcp绑定:

<bindings>
  <netTcpBinding>
    <binding name="customTcpBinding" maxReceivedMessageSize="20480000" transferMode="Streamed" >
      <security mode="None"></security>
    </binding>
  </netTcpBinding>
</bindings>