index > Team Foundation Server - Version Control > TF30063: You are not authorized to access Microsoft-IIS/6.0

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 permissions run 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(new string[] { 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

Sriman

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

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




http://blogs.msdn.com/buckh
Buck Hodges
reply 3

You can use google to search for other answers

 

More Articles

Branching bound projects and solutions does not work
Workspace cache for non .net developers
Mapping Source Control Folder from Command Line
automatic check out
Shelving
VSS Migration hanging TF60047 - how to move forward?
Team System add-on for SQL 2005 Management Studio
Team Foundation Version Control WITHOUT version in order to store...
Create new root folder?
Performing a merge using the API
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Monitoring Version Control Activity
A client application for Team Foundation?
Determine if there is a label already ap…
Perforce TS convertor
Visual Studio "Check In" ticks…
MSSCCI Provider installation error
Two different ID's seems to see the same…
Add/Edit Workspace locking up Visual Stu…
Check out source code from Solution Expl…
Team Foundation item missing from Tools …
Get by ChangeSet Not Working; Bug?
Lock Up Issuses w/ Source Control Explorer
Connection to Oracle
Why doesn't "tf history dirname&quo…
"Add Files" option greyed out

Hot Articles

Adding source files to a different VSTS …
Branch or second workspace?
Getting error "TF10201: Source cont…
How to restore the mistakenly dele…
No appropriate mapping exists for $/Proj…
Permission ACE Feature Request - Create …
TF Status question
Two different ID's seems to see the same…
Code analysis settings migration problem
Branching Model - Staircase vs. Mainline
Delete same file twice - now find first …
Project can not load while opening my So…
No changes to merge message
Binding trouble when migrating VS2003 So…
Team Projects Check-in Policy for manage…

Recommend Articles

Problem checking solution into TFS - Uns…
File content mash-up
Create Folder structure within a project.
Error: Failed to load the work item hist…
New Projects do not get retrieved on get…
Pre-migrate history not available to som…
Branching from a labeled version after a…
Version Control Setup
many applications sharing framework proj…
Error: TF60059 Incremental Migration TF…
Custom check-in policy
Shelveset history?
Setting source control policies on speci…
How do I / Can I list files within a Cha…
create work item via checkin policy