Work with TFS programmatically from ASP.NET application RRS feed

  • Question

  • I need to call Tfs Client from Asp.Net Web App.

    In IIS I create an application pool dedicated to my web app:

    - Identity: LocalSystem

    - Managed pipeline mode: Classic

    - Enable 32bit application: True

    - Load user profile: True

    I have configured authentication in IIS for my Web App:

    - Anonymous Authentication: False

    - APS.NET impersonation: True

    - Forms Authentication: False

    - Windows Authentication:True

    I have configured web.config for my web app:


         <deny users="?" />


    <authentication mode="Windows" />

    <identity impersonate="true" />

    The server is a Virtual Machine with Windows Server 2012 with Tfs2013. The VM is in a Domain. User are all Domain Users. All user are configured in TFS Team.

    In my web app code behind, I call Tfs in that way

    var credential = CredentialCache.DefaultNetworkCredentials;

    var tfs = new TfsTeamProjectCollection(TfsHelper.TfsDefaultCollectionUri, credential);



    If the Domain user is not Local Administrator of the VM, the "login" to tfs via EnsureAuthenticated is VERY VERY SLOW.

    If I give to Domain user, Local Administrator Role, the "login" is fast (IMMEDIATE).

    Can you help me?

    Friday, October 16, 2015 11:19 AM


  • Hi Andrea,  

    Thanks for your post.

    If you don’t add this domain user in local admin group, but provide this domain user in your code directly like below, what’s result:

                NetworkCredential networkCredential = new NetworkCredential("username", "passwrod"", "domainname");

                ICredentials credential = (ICredentials)networkCredential;

                TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(TfsHelper.TfsDefaultCollectionUri, credential);

    If it works fine when you provide the domain user(not added in local admin group) in code directly, please debug your initial code to check if the most time cost in “var credential = CredentialCache.DefaultNetworkCredentials;” link? If yes, I think this issue relate to your asp.net applicate get credential issue, you should contact ASP.NET experts for the better response to improve the time in “var credential = CredentialCache.DefaultNetworkCredentials;” line code.     

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, October 19, 2015 6:27 AM