Consuming WCF Service - asks for Login credentials when adding as service reference


  • I have created a WCF Service, but when I try to consume it and add it as service reference, it keeps on asking me to login thrice (3x)

    Where will I fix/set this? what I want to is to let the consumer to add it as service reference without entering credentials (Is this safe?)

    Please advise.

    ----------------------- Sharepoint Newbie

    Tuesday, March 06, 2012 2:04 AM


All replies

  • Are you trying to consume the WCF service from the same box or a different server. Are you trying to access any resource in your service code which requires authentication ?

    Varun Malhotra
    If my post solves your problem could you mark the post as Answered or Vote As Helpful if my post has been helpful for you.

    Tuesday, March 06, 2012 5:44 AM
  • I am consuming the WCF service from a different server. The WCF code only returns a string.

    ----------------------- Sharepoint Newbie

    Tuesday, March 06, 2012 7:07 AM
  • Hi,

    Thanks for your post!

    For ask login credentials for multiple times, it seems to be this situation:

    And if you want to the consumer to add it without credentials, you may consider enable anonymous access for the WCF web service.


    Simon Huang

    TechNet Community Support

    • Marked as answer by Shimin Huang Monday, March 19, 2012 1:53 AM
    Wednesday, March 07, 2012 6:54 AM
  • Is this an error in my code or this is just the behavior? Maybe the client, the one who will consume the service, will comment on this. and maybe blame my code.

    How will I enable anonymous access for the WCF service?

    ----------------------- Sharepoint Newbie

    Thursday, March 08, 2012 12:46 AM
  • Hi Shimin: if you mean to enable anonymous access to my site, then they will be able to log in to my site without using a credential right?

    How will I enable anonymous access only for my WCF

    ----------------------- Sharepoint Newbie

    Friday, March 09, 2012 9:29 AM
  • any updates

    ----------------------- Sharepoint Newbie

    Tuesday, March 13, 2012 12:57 AM
  • Visual Studio will ask your login for up to 3 times because it is trying to discover/enumerate all the services with the entered name on your machine. For example if you are trying to add a service reference to the service http://your_pc_name/HelloWorldService.svc, Visual Studio may try to discover it in these 3 places:  http://your_pc_name/HelloWorldService.svc/_vti_bin/ListData.svc/$metadata, http://your_pc_name/HelloWorldService.svc/$metadata, and http://your_pc_name/HelloWorldService.svc.

    Note Visual Studio will only ask your login if the WCF service is secured (e.g. Basic authentication is enabled). It won't ask your login if Anonymouse is enabled for your WCF service.

    • Edited by mikeliu88 Sunday, November 04, 2012 2:16 PM
    Sunday, November 04, 2012 2:15 PM