WCF Client not working on some pcs RRS feed

  • Question

  • Hello!

    I have created a WCF Client for a service using a custom binding and it works in most cases. In some pcs however i get the error

    "Username is not provided".

    I tried different bindings but it's not working.

    Any suggestions?

    Thank you in advance

    • Edited by PanosK83 Monday, June 1, 2020 9:28 PM
    Monday, June 1, 2020 9:28 PM

All replies

  • Did you set the clientcredentialtype to username:

            <!-- Username binding -->
            <binding name="Binding1">
              <security mode="Message">
    	          <message clientCredentialType="UserName"/>

    This configuration allows the service to require that the client be authenticated with a user name credential.

    By default, when a user name and password is used for authentication, Windows Communication Foundation (WCF) uses Windows to validate the user name and password. However, WCF allows for custom user name and password authentication schemes, also known as validators.Example:

     public class CustomUserNameValidator : System.IdentityModel.Selectors.UserNamePasswordValidator
                public override void Validate(string userName, string password)
                    if (null == userName || null == password)
                        throw new ArgumentNullException();
                    if (!(userName == "test1" && password == "test1") && !(userName == "test2" && password == "test2"))
                        throw new FaultException("Unknown Username or Incorrect Password");

    The client-side must provide username and password when calling the server-side.If the client-side does not provide username and password, the error "The username is not provided" will appear.

    proxy.ClientCredentials.UserName.UserName = "test1";
    proxy.ClientCredentials.UserName.Password = "test1";

    You can also set the clientcredentialtype to None so that the client-side does not need to provide any credentials to the server-side.

    • Edited by Peng Ding Tuesday, June 2, 2020 7:31 AM
    Tuesday, June 2, 2020 7:30 AM
  • Hello! Thank you for your answer.

    My custom binding is implemented in code and i use 


    I also set the ClientCredentials before calling the service.

    It works in most cases, but in some workstations in a specific network does not work.

    Thank you again

    Tuesday, June 2, 2020 9:07 AM
  • If so, it probably has nothing to do with the code.Maybe there is something wrong with network settings,for example, are they in the same Windows domain or what is the difference between their networks.
    Wednesday, June 3, 2020 8:24 AM
  • I rewrote the client using chilkat and it works. 

    Thank you for help

    Wednesday, June 3, 2020 12:02 PM