Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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# 使用简单的基于用户配置的身份验证使WCF服务在HTTP上运行_C#_Wcf_Authentication - Fatal编程技术网

C# 使用简单的基于用户配置的身份验证使WCF服务在HTTP上运行

C# 使用简单的基于用户配置的身份验证使WCF服务在HTTP上运行,c#,wcf,authentication,C#,Wcf,Authentication,我上下查看了一下,似乎找不到一个简单的WCF服务(使用basicHttpBinding或wsHttpBinding)根据这种配置进行身份验证: <authentication mode="Forms"> <forms cookieless="UseCookies"> <credentials passwordFormat="Clear"> <user name="test" password="pass"/> <

我上下查看了一下,似乎找不到一个简单的WCF服务(使用
basicHttpBinding
wsHttpBinding
)根据这种配置进行身份验证:

<authentication mode="Forms">
  <forms cookieless="UseCookies">
    <credentials passwordFormat="Clear">
      <user name="test" password="pass"/>
    </credentials>
  </forms>
</authentication>
但这些证书似乎没有被传递出去。HttpContext.Current.User.Identity从未在WCF端进行身份验证

我尝试过使用下面的设置,尝试使用从无、传输、消息。。。但似乎只有
None
允许服务运行(但没有发送/使用凭据)。其他设置似乎需要X509证书(如我在中发现的)



所以,总而言之。。。我想创建一个非常简单的WCF服务(通过HTTP而不是HTTPS运行),使用更简单的纯文本用户名/密码身份验证。应该是可能的,但我已经迷路了。最好的解决方案是尊重
条目,但我很乐意接受任何其他简单的实现。它不需要使用cookies。就我而言,它还可以在每次服务方法调用时发送用户名/密码。

如果您希望在消息级别发送不带ssl的用户/密码,请使用。如果您希望在传输级别使用相同的功能,请使用


client.ClientCredentials.UserName.UserName = "test";
client.ClientCredentials.UserName.Password = "pass";
  <wsHttpBinding>
    <binding name="userHttp">
      <security mode="None">
        <message clientCredentialType="UserName"/>
      </security>
    </binding>
  </wsHttpBinding>
<binding name="BasicHttpEndpointBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" />
      </security>
</binding>