重现问题:客户端身份验证方案禁止 http 请求'anonymous'



我想重现 wcf 问题:客户端身份验证方案"匿名"禁止 http 请求

我们在产品中使用 wcf 服务,我们已将 wcf 服务托管为 Windows 服务(自托管服务),并且此 wcf 服务由小型 Windows 客户端应用程序使用。

在我们的环境中,一切正常。但是,我们的一位客户报告说,当他们从远程客户端计算机连接客户端应用程序时,他们收到错误"客户端身份验证方案'匿名'禁止 http 请求"。

在这里,我的问题是,任何人都可以帮助我在我们的环境中重新生成此问题,以便我们可以提供完美的解决方案。

ServiceApp.config

<bindings>
      <wsHttpBinding>
        <binding name="MyBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="100" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
          <reliableSession inactivityTimeout="24.00:00:00" />
          <security mode="None">
            <message clientCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="MyBehaviour" name="WcfServer.CalculatorService">
        <endpoint address="http://localhost:7000/Test" behaviorConfiguration="MyEndPointBehavior"
          binding="wsHttpBinding"  bindingConfiguration="MyBinding"
          name="EndPt_Service" contract="WcfServer.ICalculator"/>
      </service>
    </services>

clientapp.config

<bindings>
      <wsHttpBinding>
        <binding name="CalBinding" maxBufferPoolSize="2147483647"  maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="100" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
          <reliableSession inactivityTimeout="24.00:00:00" />
          <security mode="None">
            <message clientCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://RemoteServerName:7000/Test" behaviorConfiguration="CalEndPointBehavior"
        binding="wsHttpBinding" contract="WcfServer.ICalculator"
         name="EndPt_Calc" bindingConfiguration="CalBinding"/>
    </client>

我在msdn论坛中找到了这个,希望这对您有所帮助:

由于您为 WsHttpBinding 指定了安全模式 = none,因此当它向 WCF 服务发出请求时,服务将尝试使用 Aninymous 凭据对客户端进行身份验证,但在不同的域中,这将不起作用,因此请尝试使用 X509 证书。

因此,请尝试在两个不同的域之间建立连接。

最新更新