wcf https with basic auth

时间:2016-12-15 18:33:59

标签: c# wcf wcf-ria-services

我正在尝试使用基本身份验证使用https服务。

结合:

<bindings>   
  <wsHttpBinding>
    <binding name="apiSoap11">
      <security mode="Transport">
        <transport clientCredentialType="Basic" />
      </security>
    </binding>   
 </wsHttpBinding> 

<client>   
     <endpoint address="https://url"
                binding="wsHttpBinding"
                bindingConfiguration="apiSoap11"
                contract="api"
      name="apiSoap11" />
    </client>

代码

var client = new Client();

client.ClientCredentials.UserName.UserName = "username";
client.ClientCredentials.UserName.Password = "password";

var response = client.operation(request);

我收到500错误。

此请求将在SoapUi中使用基本身份验证和PasswordType =&#34; PasswordText&#34;

知道我错过了什么。

0 个答案:

没有答案