客户端身份验证方案“Ntlm”不允许HTTP请求

时间:2014-03-07 07:31:07

标签: c# .net windows wcf

我发现了this问题,但似乎不是我的方式:(

我有客户端服务(控制台应用程序),在服务器端 - Bitrix CMS Web服务。 所以,一切运作良好,但是当我有一天在我的VS 2012上更新服务时 调用Send(...)方法 - 我收到错误:

Received from the server authentication header "NTLM". HTTP request is not allowed for client authentication scheme "Ntlm". Received from the server authentication header "NTLM".

(谷歌翻译)

我尝试删除并重新创建服务,重新启动VS,重启Windows - 它无法正常工作。

所以,app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>
     <basicHttpBinding>
       <binding name="CTfsTasksWSBinding">
         <security mode ="TransportCredentialOnly">
        <transport clientCredentialType="Ntlm"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://server.domen.local/tfs_tasks_ws.php"
    binding="basicHttpBinding" bindingConfiguration="CTfsTasksWSBinding"
    contract="Bitrix.CTfsTasksWSInterface" name="CTfsTasksWSSoap" />
</client>
</system.serviceModel> 
<connectionStrings>
 <add name="DefaultConnection" connectionString="Data Source = |SQL/CE|" />
</connectionStrings>
</configuration>

所以,我的代码:

 Bitrix.CTfsTasksWSInterfaceClient cll = new Bitrix.CTfsTasksWSInterfaceClient();
 cll.ClientCredentials.Windows.ClientCredential = new  System.Net.NetworkCredential(loginn, passwd);
 cll.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;

我创建了新的简单控制台应用程序并从主应用程序粘贴了一些代码 - 我有同样的错误。

请帮我解决这个问题。 谢谢。

1 个答案:

答案 0 :(得分:0)

我没有有效的密码。 一切正常。