TF30063: You are not authorized to access Microsoft-IIS/6.0

Hi: I have created a asp.net 2.0 web application that checks out a file from TFS and modify the file then checks in the file. I gave permissionsrun the worker process under an account that has access to the TFS server. I have full aaccess to TFS.

<identity impersonate="true"

userName="xxxx\xxxxxx"

password="********"/>

and at the time of check-in. I get the above error.

Here is the code for checkin:

bool TFSCheckin(string filename)

{

bool CheckedIn =false;

try

{

TeamFoundationServer tfs =TeamFoundationServerFactory.GetServer(tfsName);

VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));

UserName = vcs.AuthenticatedUser;

// get workspace for local build files editing

Workspace[] workspaces = vcs.QueryWorkspaces(WorkspaceName, UserName,

ComputerName);

Workspace workspace =null;

// either create or take found workspace

if (workspaces.Length == 0)

workspace = vcs.CreateWorkspace(WorkspaceName, UserName, WorkspaceComment);

else

workspace = workspaces[0];

// check - if project is not mapped, then map it

if (!workspace.IsServerPathMapped(ProjectServerPath))

{

workspace.Map(ProjectServerPath, ProjectLocalPath);

}

PendingChange[] changes = workspace.GetPendingChanges();

if (changes.Length > 0)

{

int changeSetNumber =

workspace.CheckIn(changes,"Checked in the file at:" +DateTime.Today.ToString() +" By " + UserName);

el.WriteEntry(" Checked in the file :" + changeSetNumber);

CheckedIn =true;

}

else

{

el.WriteEntry(" Can not checkin the file to tfs : " + UserName);

}

}

catch (Exception ex)

{

el.WriteEntry(" Can not checkin the file from tfs, connection failed to tfsserver :" + ex.Message);

}

finally

{

}

return CheckedIn;

}

Here is the code for Checkout:

bool TFSCheckout(string filename)

{

bool CheckedOut =false;

try

{

TeamFoundationServer tfs =TeamFoundationServerFactory.GetServer(tfsName);

VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));

UserName = vcs.AuthenticatedUser;

// get workspace for local build files editing

Workspace[] workspaces = vcs.QueryWorkspaces(WorkspaceName, UserName,

ComputerName);

Workspace workspace =null;

// either create or take found workspace

//Label2.Text = "Workspace length : " + workspaces.Length;

if (workspaces.Length == 0)

workspace = vcs.CreateWorkspace(WorkspaceName, UserName, WorkspaceComment);

else

workspace = workspaces[0];

// check - if project is not mapped, then map it

if (!workspace.IsServerPathMapped(ProjectServerPath))

{

workspace.Map(ProjectServerPath, ProjectLocalPath);

}

//workspace.PendEdit(new string[] { DIR + filename }, RecursionType.OneLevel, null, LockLevel.None);

workspace.PendEdit(newstring[] { DIR + filename },RecursionType.Full,null,LockLevel.CheckOut);

el.WriteEntry("File checkedout: " + DIR + filename);

CheckedOut =false;

}

catch (Exception ex)

{

el.WriteEntry("Exception :Connecting to TFS : " + DIR + filename +" " + ex.Message);

//ThrowError("Can not checkout the file from tfs, connection failed to tfsserver :" + ex.Message);

}

finally

{

}

return CheckedOut;

}

In between these two operations Checkout and checkin I overwrite the my file with new stuff or remove some code from this file. Any quick help is appreciated.

Thanks

Sriman

[6031 byte] By [Sriman] at [2007-12-24]
# 1

I found the solution: machine.config processmodel updated

<processModel enable="true"
userName="Domain\username"
password="xxxxxxxxxxxxxxxxxxx"/>

everything works fine. Buck thanks for your help!!!!!!!!!!!!111

Sriman at 2007-10-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 2

For the background on this, the issue has to do with the fact that file uploads and downloads occur on background threads from the ThreadPool. These threads do not get the credentials from impersonation.

The final part of the work around was changing the app pool's identity (this code is from a web app) to be something that has access to version control. This is far from ideal, but impersonation combined with the change to the app pool identity is the best approach available with v1.

Buck

BuckHodges at 2007-10-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 3

I'm also receiving this error. I first saw it in the event log a few minutes after I checked in some files into source control and now it occurs every hour. I also get the same error when trying to retrieve a file through Team Explorer. My TFS server is using SSL with the ISAPI filter if that makes a difference.

TF53010: An unexpected condition has occurred in a Team Foundation component. The information contained here should be made available to your site administrative staff.

Technical Information (for the administrative staff):

Date (UTC): 1/10/2007 4:37:44 AM

Machine: <MACHINE_NAME>

Application Domain: /LM/W3SVC/3/Root/Warehouse-1-128128774379870240

Assembly: Microsoft.TeamFoundation.Warehouse, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727

Process Details:

Process Name: w3wp

Process Id: 4284

Thread Id: 4344

Account name: <ACCOUNT_NAME>

Detailed Message: Microsoft.TeamFoundation.VersionControl.Adapter: An error occurred while processing changeset 23, unexpected exception:

Exception Message: TF30063: You are not authorized to access Microsoft-IIS/6.0. (type TeamFoundationServerUnauthorizedException)

Exception Stack Trace: at Microsoft.TeamFoundation.VersionControl.Client.Client.EndDownloadFile(IAsyncResult asyncResult)

at Microsoft.TeamFoundation.VersionControl.Client.Client.DownloadFile(String downloadUrl, String localFileName)

at Microsoft.TeamFoundation.VersionControl.Client.Item.DownloadFile(String localFileName)

at Microsoft.TeamFoundation.VersionControl.Adapter.Hatteras.calculateDifferences(Item previous, Item current)

at Microsoft.TeamFoundation.VersionControl.Adapter.Hatteras.calculateChurnForFilePair(FilePair filePair)

at Microsoft.TeamFoundation.VersionControl.Adapter.VCAdapter.processChangesets()

Atapaz at 2007-10-8 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...

Visual Studio Team System

Site Classified