Tags: aspx, bugs, connects, creating, display, gridview, ide, inside, locally, microsoft, msdn, page, software, studio, tfs, tfsauthenticate, visual, working

TFS.authenticate();

On Microsoft » Microsoft Visual Studio

17,754 words with 4 Comments; publish: Wed, 19 Dec 2007 08:37:00 GMT; (300109.38, « »)

Hello all!

I'm creating a simple .aspx page that connects to TFS and display the list of bugs in a GridView.

When working locally from inside my IDE it works. When I debug and step into it all works well.

Now I've decided to Publish my web site, still locally on my machine, I created a folder and then publish my web site to that newly created folder. Then I created a virtual directory that points to that folder and tried to run it but it fails.

I've attached to aspnet_wp.exe process to see what goes on and realized that from inside the IDE I did not need to impersonate but once deployed, even locally on my machine, I needed to add an instruction in the web.config in order to impersonate. The actual line is:

<identity impersonate="true" userName="domainename\user" password="12345"/>

Then I opened IIS and browsed my virtual Directory and attached to process from my IDE to see what goes on and the tfs.Authenticate(); line of code seems to now work.

NOTE: Keep in mind that I've been looking at the Work Item Object Model Sample from the extensibility kit provided and basically copied the exact same thing. The code I have is the following:

TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(DomainName);

// For debugging only, to see what's the userName that is Authenticated

string tfsUser = tfs.AuthenticatedUserName;

tfs.Authenticate();

WorkItemStore store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

// Check if we have any projects

if (store.Projects.Count <= 0)

{return null;}

....more code.....

The error I get now is the following which I honestly do not understand...

In order to pinpoint the problem, I've tried it in debug mode(hitting F5) and it worked so its definitely a security issue.

What am I missing?

I've done the impersonating thing...what do I need in addition to impersonate?

Many thanks to anyone that can help!

Sincerely

Vince

Access is denied.

(Windows)

Could not create metadata cache directory '?|'. (Currituck Metadata Cache)

Could not open file '|'. (Currituck Metadata Cache)

Access is denied.

(Windows)

Could not create metadata cache directory '?|'. (Currituck Metadata Cache)

Could not open file '|'. (Currituck Metadata Cache)

Could not initialize metadata cache for product '??'. (Currituck Metadata Cache)

Unspecified error

(Windows) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.TeamFoundation.WorkItemTracking.Client.ClientException:

Access is denied.

(Windows)

Could not create metadata cache directory '?|'. (Currituck Metadata Cache)

Could not open file '|'. (Currituck Metadata Cache)

Access is denied.

(Windows)

Could not create metadata cache directory '?|'. (Currituck Metadata Cache)

Could not open file '|'. (Currituck Metadata Cache)

Could not initialize metadata cache for product '??'. (Currituck Metadata Cache)

Unspecified error

(Windows)

Source Error:

Line 40: tfs.Authenticate(); Line 41: Line 42: WorkItemStore store = (WorkItemStore)tfs.GetService(typeof(WorkItemStore)); Line 43: Line 44: // Check if we have any projects

All Comments

Leave a comment...