realtytrac
05-18-2006, 12:03 PM
Hello,
I'm using the object model to run scripts on top of an ASP.NET 2.0 web application. The web app uses windows integrated security, and impersonation for security purposes because my script will need to copy files to multiple servers.
I have gotten so many permissions errors its unbelievable. I was able to get around some of them simply by giving EVERYONE permission on the folders i am testing with (a solution that will not hold when i move to production).
One of these errors is when i try to do a simple copy of files from my box to another server. Under the impersonation account that my web app runs under, the copy should be no problem at all. I have full access to the folders i am trying to access. in fact, when i access them through convential ASP.NET code, there is absolutely no problem at all.
However, when i run the build script through the API, all these permission problems come about, the one above being "Error creating destination path '\\webdev\DEVLaunchFolder\Websites\RealtyTrac\Test App\': Logon failure: unknown user name or bad password." I did an audit on the destination path and found that its my ASPNET username from my machine that is trying to access that folder, and naturally that is not permitted. This is happening even though i am using impersonation, which is odd. Then i researched a bit and found out that some COM components can not be passed the impersonation tokens if their apartment state is single threaded. So i figured maybe that is what is happing with the visual build pro COM object. Soooo, i went further and created a separate thread that is STA. in that thread, i do impersonation (again!) using LogonUser, and execute the code. SAME ERROR COMES UP. I am lost, and i need help with this. It just doesn't sound correct that Visual Build Pro's API can not execute copies to other servers, something so elemental to the application.
PLEASE HELP
The following is the message i get back when i execute the build script:
5/18/2006 9:51:19 AM: Building Project Step 'Project Steps'...
Step 'Project Steps' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Move to DEV Rollback Folder'...
Step 'Move to DEV Rollback Folder' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Copy ASPX and root'...
C:\Working\Testing\RealtyTracBuilds\DEV\4_12_2006-04\Push\TestApp\ -> C:\Working\Testing\RealtyTracBuilds\DEV\3_31_2006-03\Rollback\TestApp\
Copying: Global.asax
Copying: Web.config
Copying: WebForm1.aspx
Copying: WebForm2.aspx
Copying: WebForm3.aspx
Copying: bin\TestApp.dll
6 file(s) copied, 0 file(s) deleted
Step 'Copy ASPX and root' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Clean the TestApp build folder'...
-> C:\Inetpub\wwwroot\TestApp\
0 file(s) copied, 17 file(s) deleted
Step 'Clean the TestApp build folder' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Labeled Application'...
Step 'Labeled Application' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Get Label TestApp'...
"C:\Program Files\SourceGear\Vault Client\vault.exe" -host SERVER_NAME -user USER -password xxx -repository REP_NAME getlabel $/TestApp 3/31/2006-03 -setfiletime current -destpath C:\Inetpub\wwwroot\TestApp
Step 'Get Label TestApp' completed, status = Succeeded
5/18/2006 9:51:22 AM: Building Project Step 'Latest Application'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Latest Application' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Delete Label TestApp'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Delete Label TestApp' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Get Latest TestApp'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Get Latest TestApp' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Label TestApp'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Label TestApp' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Build Solution'...
Pre-processing...
Building configuration 'Release'...
Microsoft (R) Development Environment Version 7.10.3077. Copyright (C) Microsoft Corp 1984-2001. All rights reserved. ------ Build started: Project: TestApp, Configuration: Release .NET ------ Preparing resources...
Updating references... Performing main compilation...
Build complete -- 0 errors, 0 warnings Building satellite assemblies... ---------------------- Done ----------------------
Build: 1 succeeded, 0 failed, 0 skipped
Step 'Build Solution' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Move to DEV Push Folder'...
Step 'Move to DEV Push Folder' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Copy ASPX and root'...
C:\Inetpub\wwwroot\TestApp\ -> C:\Working\Testing\RealtyTracBuilds\DEV\3_31_2006-03\Push\TestApp\
Copying: Global.asax
Copying: Web.config
Copying: WebForm1.aspx
Copying: WebForm2.aspx
Copying: WebForm3.aspx
Copying: bin\TestApp.dll
6 file(s) copied, 0 file(s) deleted
Step 'Copy ASPX and root' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Update DEV files'...
Step 'Update DEV files' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Change web.config'...
1 match(es) found, 1 replacement(s) made in file
Step 'Change web.config' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Move To DEV Server'...
Step 'Move To DEV Server' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Copy ASPX and root'...
Error creating destination path '\\webdev\DEVLaunchFolder\Websites\RealtyTrac\Test App\': Logon failure: unknown user name or bad password.
Step 'Copy ASPX and root' completed, status = Failed
I'm using the object model to run scripts on top of an ASP.NET 2.0 web application. The web app uses windows integrated security, and impersonation for security purposes because my script will need to copy files to multiple servers.
I have gotten so many permissions errors its unbelievable. I was able to get around some of them simply by giving EVERYONE permission on the folders i am testing with (a solution that will not hold when i move to production).
One of these errors is when i try to do a simple copy of files from my box to another server. Under the impersonation account that my web app runs under, the copy should be no problem at all. I have full access to the folders i am trying to access. in fact, when i access them through convential ASP.NET code, there is absolutely no problem at all.
However, when i run the build script through the API, all these permission problems come about, the one above being "Error creating destination path '\\webdev\DEVLaunchFolder\Websites\RealtyTrac\Test App\': Logon failure: unknown user name or bad password." I did an audit on the destination path and found that its my ASPNET username from my machine that is trying to access that folder, and naturally that is not permitted. This is happening even though i am using impersonation, which is odd. Then i researched a bit and found out that some COM components can not be passed the impersonation tokens if their apartment state is single threaded. So i figured maybe that is what is happing with the visual build pro COM object. Soooo, i went further and created a separate thread that is STA. in that thread, i do impersonation (again!) using LogonUser, and execute the code. SAME ERROR COMES UP. I am lost, and i need help with this. It just doesn't sound correct that Visual Build Pro's API can not execute copies to other servers, something so elemental to the application.
PLEASE HELP
The following is the message i get back when i execute the build script:
5/18/2006 9:51:19 AM: Building Project Step 'Project Steps'...
Step 'Project Steps' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Move to DEV Rollback Folder'...
Step 'Move to DEV Rollback Folder' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Copy ASPX and root'...
C:\Working\Testing\RealtyTracBuilds\DEV\4_12_2006-04\Push\TestApp\ -> C:\Working\Testing\RealtyTracBuilds\DEV\3_31_2006-03\Rollback\TestApp\
Copying: Global.asax
Copying: Web.config
Copying: WebForm1.aspx
Copying: WebForm2.aspx
Copying: WebForm3.aspx
Copying: bin\TestApp.dll
6 file(s) copied, 0 file(s) deleted
Step 'Copy ASPX and root' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Clean the TestApp build folder'...
-> C:\Inetpub\wwwroot\TestApp\
0 file(s) copied, 17 file(s) deleted
Step 'Clean the TestApp build folder' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Labeled Application'...
Step 'Labeled Application' completed, status = Succeeded
5/18/2006 9:51:19 AM: Building Project Step 'Get Label TestApp'...
"C:\Program Files\SourceGear\Vault Client\vault.exe" -host SERVER_NAME -user USER -password xxx -repository REP_NAME getlabel $/TestApp 3/31/2006-03 -setfiletime current -destpath C:\Inetpub\wwwroot\TestApp
Step 'Get Label TestApp' completed, status = Succeeded
5/18/2006 9:51:22 AM: Building Project Step 'Latest Application'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Latest Application' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Delete Label TestApp'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Delete Label TestApp' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Get Latest TestApp'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Get Latest TestApp' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Label TestApp'...
Step 'Latest Application' build rule evaluates false: %FIRST_BUILD% (expanded value = false) is equal to true
Step 'Label TestApp' completed, status = Skipped
5/18/2006 9:51:22 AM: Building Project Step 'Build Solution'...
Pre-processing...
Building configuration 'Release'...
Microsoft (R) Development Environment Version 7.10.3077. Copyright (C) Microsoft Corp 1984-2001. All rights reserved. ------ Build started: Project: TestApp, Configuration: Release .NET ------ Preparing resources...
Updating references... Performing main compilation...
Build complete -- 0 errors, 0 warnings Building satellite assemblies... ---------------------- Done ----------------------
Build: 1 succeeded, 0 failed, 0 skipped
Step 'Build Solution' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Move to DEV Push Folder'...
Step 'Move to DEV Push Folder' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Copy ASPX and root'...
C:\Inetpub\wwwroot\TestApp\ -> C:\Working\Testing\RealtyTracBuilds\DEV\3_31_2006-03\Push\TestApp\
Copying: Global.asax
Copying: Web.config
Copying: WebForm1.aspx
Copying: WebForm2.aspx
Copying: WebForm3.aspx
Copying: bin\TestApp.dll
6 file(s) copied, 0 file(s) deleted
Step 'Copy ASPX and root' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Update DEV files'...
Step 'Update DEV files' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Change web.config'...
1 match(es) found, 1 replacement(s) made in file
Step 'Change web.config' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Move To DEV Server'...
Step 'Move To DEV Server' completed, status = Succeeded
5/18/2006 9:51:29 AM: Building Project Step 'Copy ASPX and root'...
Error creating destination path '\\webdev\DEVLaunchFolder\Websites\RealtyTrac\Test App\': Logon failure: unknown user name or bad password.
Step 'Copy ASPX and root' completed, status = Failed