WCFTestClient The HTTP request is unauthorized with client authentication scheme 'Anonymous'

前端 未结 9 1488
囚心锁ツ
囚心锁ツ 2020-12-05 01:34

I\'ve created one WCF service and deployed it on Server. When I browse this service it gives me positive response with ?wsdl URL. Now I\'m trying to test the service through

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-05 02:04

    Another possible solution to this error that I found. Might not have answered OP's exact question but may help others who stumble across this error message.

    I was creating my Client in code using WebHttpBinding, in order to replicate the following line:

    
      
    
    

    I had to do:

    var binding = new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly);
                    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
                    binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Windows;
    

    as well as setting proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

提交回复
热议问题