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 editingWorkspace[] workspaces = vcs.QueryWorkspaces(WorkspaceName, UserName,ComputerName);
Workspace workspace =null;// either create or take found workspaceif (workspaces.Length == 0)workspace = vcs.CreateWorkspace(WorkspaceName, UserName, WorkspaceComment);
elseworkspace = workspaces[0];
// check - if project is not mapped, then map itif (!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 editingWorkspace[] 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);
elseworkspace = workspaces[0];
// check - if project is not mapped, then map itif (!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

