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

前端 未结 9 1497
囚心锁ツ
囚心锁ツ 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:14

    I didn't have control over the security configuration for the service I was calling into, but got the same error. I was able to fix my client as follows.

    1. In the config, set up the security mode:

      
        
        
      
      
    2. In the code, set the proxy class to allow impersonation (I added a reference to a service called customer):

      Customer_PortClient proxy = new Customer_PortClient();
      proxy.ClientCredentials.Windows.AllowedImpersonationLevel =    
               System.Security.Principal.TokenImpersonationLevel.Impersonation;
      

提交回复
热议问题