I am developing a Web Application trying to connect to TFS using TFS API in C#. The following line of code is generating a runtime error when deployed onto ISS. It works fine on my local box :
WorkItemStore workItemStore = coll.GetService<WorkItemStore>();
Here is my entire code :
Uri url = new Uri("https://xxx.xx.com:443/xxx/xxx");
NetworkCredential nc = new NetworkCredential("xx", "xx", "xx");
TfsTeamProjectCollection coll = new TfsTeamProjectCollection(url, nc);
coll.EnsureAuthenticated();
// Error causing code Begin
WorkItemStore workItemStore = coll.GetService<WorkItemStore>();
// Error causing code End
The error screenshot is as shown below :
Is there a way to solve it or a work around ?
here is the error message in the screenshot above :
*Description : An unhandled exception occured during the execution of the current web request. Please review the stack trace for more information about the error and where it originated inthe code.
Exception details : System.UnauthorizedAccessException: Access to the Path "C"\ProgramData\Microsoft\Team Foundation\3.0\Cache" is denied.
ASP.NET is not authorized to acccess the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP>NET has a base process identity {typically {MACHINE}}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonationg. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP>NET account, and check the boxes for the desired access.*
Let me know if you also want to look at the stack strace ?