The HTTP request is unauthorized with client authentication scheme 'Ntlm' The authentication header received from the server was 'NTLM'

后端 未结 10 2221
滥情空心
滥情空心 2020-12-01 00:21

I know there\'s a lot of questions on SO similar to this, but I couldn\'t find one for this particular issue.

A couple of points, first:

  • I have n
相关标签:
10条回答
  • 2020-12-01 00:25

    I had exactly the same issue last week - WCF program behaves strangely on one server - why?

    For me the solution was rather simple. Sharepoint has its own set of permissions. My client tried to log on as a user that wasn't explicitly given access to the webservice through Sharepoint's administration panel.

    I added the user to Sharepoint's whitelist and bang - it just worked.

    Even if that isn't the issue, please note that

    The HTTP request is unauthorized with client authentication scheme ‘Ntlm’. The authentication header received from the server was ‘NTLM’.

    Means (in English) that you simply don't have permission. Your protocol is probably right - your user just doesn't have permissions.

    0 讨论(0)
  • 2020-12-01 00:27

    After many answers that did not work, I finally found a solution when Anonymous access is Disabled on the IIS server. Our server is using Windows authentication, not Kerberos. This is thanks to this blog posting.

    No changes were made to web.config.

    On the server side, the .SVC file in the ISAPI folder uses MultipleBaseAddressBasicHttpBindingServiceHostFactory

    The class attributes of the service are:

    [BasicHttpBindingServiceMetadataExchangeEndpointAttribute]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class InvoiceServices : IInvoiceServices
    {
    ...
    }
    

    On the client side, the key that made it work was the http binding security attributes:

    EndpointAddress endpoint =
      new EndpointAddress(new Uri("http://SharePointserver/_vti_bin/InvoiceServices.svc"));
    BasicHttpBinding httpBinding = new BasicHttpBinding();
    httpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
    httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
    InvoiceServicesClient myClient = new InvoiceServicesClient(httpBinding, endpoint);
    myClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; 
    
    (call service)
    

    I hope this works for you!

    0 讨论(0)
  • 2020-12-01 00:31

    I have the same setup that you do, and this works fine for me. I think that maybe the problem lies somewhere on your moss configuration or on your network.

    You said that moss resides on the same domain as your application. If you have access to the site with your user (that is logged into your machine)... have you tried:

    client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
    
    0 讨论(0)
  • 2020-12-01 00:32

    If I recall correctly, there are some issues with adding SharePoint web services as a VS2K8 "Service Reference". You need to add it as an old-style "Web Reference" to work properly.

    0 讨论(0)
  • 2020-12-01 00:33

    This issue was even more strange for us. Everything worked if you had previously visited the sharepoint site from the browser, before you made the SOAP call. However, if you did the SOAP call first we'd throw the above error.

    We were able to resolve this issue by installing the sharepoint certificate on the client and adding the domain to the local intranet sites.

    0 讨论(0)
  • 2020-12-01 00:34

    Try this

    <client>
      <endpoint>
        <identity>
          <servicePrincipalName value="" />
        </identity>
      </endpoint>
    </client>
    

    I've encountered this error before when working in a webfarm and this fixed it for me.

    0 讨论(0)
提交回复
热议问题