WCF error: The caller was not authenticated by the service

前端 未结 10 482
野性不改
野性不改 2020-12-01 03:53

I am trying to access my WCF service on a server from my client console application for testing. I am getting the following error:

The caller was no

相关标签:
10条回答
  • 2020-12-01 03:56

    If you're using a self hosted site like me, the way to avoid this problem (as described above) is to stipulate on both the host and client side that the wsHttpBinding security mode = NONE.

    When creating the binding, both on the client and the host, you can use this code:

     Dim binding as System.ServiceModel.WSHttpBinding 
     binding= New System.ServiceModel.WSHttpBinding(System.ServiceModel.SecurityMode.None)
    

    or

     System.ServiceModel.WSHttpBinding binding
     binding = new System.ServiceModel.WSHttpBinding(System.ServiceModel.SecurityMode.None);
    
    0 讨论(0)
  • 2020-12-01 03:57

    Why can't you just remove the security setting altogether for wsHttpBinding ("none" instead of "message" or "transport")?

    0 讨论(0)
  • 2020-12-01 03:59

    set anonymous access in your virtual directory

    write following credentials to your service

    ADTService.ServiceClient adtService = new ADTService.ServiceClient();
    adtService.ClientCredentials.Windows.ClientCredential.UserName="windowsuseraccountname";
    adtService.ClientCredentials.Windows.ClientCredential.Password="windowsuseraccountpassword";
    adtService.ClientCredentials.Windows.ClientCredential.Domain="windowspcname";
    

    after that you call your webservice methods.

    0 讨论(0)
  • 2020-12-01 04:03

    Have you tried using basicHttpBinding instead of wsHttpBinding? If do not need any authentication and the Ws-* implementations are not required, you'd probably be better off with plain old basicHttpBinding. WsHttpBinding implements WS-Security for message security and authentication.

    0 讨论(0)
  • 2020-12-01 04:06

    I was able to resolve the shared issue by following below steps:

    1. Go to IIS-->Sites-->Your Site-->
    2. Features View Pane-->Authentication
    3. Set Anonymous Authentication to Disabled
    4. Set Windows Authentication to Enabled

    0 讨论(0)
  • 2020-12-01 04:06

    I also had the same problem in wsHtppBinding. And I just had to add security mode pointing to none, that solved my problem and no need to switch to basicHttpBinding. Check Here and check how to disable WCF security. Check the below config change for reference:

    <wsHttpBinding>
        <binding name="soapBinding">
            <security mode="None">
                <transport clientCredentialType="None" />
                <message establishSecurityContext="false" />
            </security>
        </binding>
    </wsHttpBinding>
    
    0 讨论(0)
提交回复
热议问题