Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# httpBasicBinding具有身份验证,无消息或传输安全性_C#_Wcf - Fatal编程技术网

C# httpBasicBinding具有身份验证,无消息或传输安全性

C# httpBasicBinding具有身份验证,无消息或传输安全性,c#,wcf,C#,Wcf,我在intranet中有一个小型WCF服务,我需要在其中实现身份验证。此服务通过http与不同的Java客户端通信(使用basicHttpBinding)。我尝试过这样配置绑定 <basicHttpBinding> <binding> <security mode="None"> <message clientCredentialType="UserName"/> </security&g

我在intranet中有一个小型WCF服务,我需要在其中实现身份验证。此服务通过http与不同的Java客户端通信(使用basicHttpBinding)。我尝试过这样配置绑定

   <basicHttpBinding>
    <binding>
      <security mode="None">
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
  </basicHttpBinding>

和附加服务行为

    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="LocalTasks.Services.Validators.IntegrationUserNameValidator,LocalTasks.Services"/>
      </serviceCredentials>
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>

但是对该服务的调用不会命中我的自定义用户名密码验证器。 我也尝试了相同的变体,但将安全模式设置为Message并添加了证书。在这种情况下,验证器工作正常


如何配置服务以通过basicHttpBinding对用户进行身份验证,而无需任何消息或传输安全性?

您不能这样做。您需要消息或传输安全性,以便在凭据从客户端传输到服务器时对其进行加密

您确实应该使用消息或传输安全性

您还可以使用
TransportCredentialOnly
,它不需要SSL证书,但建议仅用于测试

<basicHttpBinding>
  <binding name="Authentication" >
    <security mode="TransportCredentialOnly" >
      <message clientCredentialType="UserName"/>
    </security>
  </binding>
</basicHttpBinding>


因为它需要在Java客户端的遗留代码中进行修改。所以,在没有任何安全性的情况下,无法通过开放的http通道向服务器发送凭据?如果您仍然无法进行加密,则可以使用“TransportCredentialOnly”安全模式。看我的编辑,我明白了。所需的任何其他配置?clientCredentialType=“Basic”都可以正常工作!谢谢!这种变体不起作用。呼叫在没有任何身份验证的情况下被处理。