I finally found an article that tries to explain what to do to copy a
project so you have a working copy that doesn't mess with the original,
here it is:
http://www.informit.com/articles/article.asp?p=28502&seqNum=5&rl=1
After proceeding with the instruction under 'Moving a Visual Studio
ASP.NET Web Application Project' my application still had errors. In
the end, it was a permissions problem because impersonation was set to
true and the account it was impersonating did not have permissions to
the .NET Temp files. I've included a detailed account of my process
and results for future newbies as I had a hard time finding an
explanation that I could understand.
Steps taken:
1. Opened solution of project I want to copy
(\\myservername\c$\Inetpub\wwwroot\webprojects\ProjectSearch\ProjectSearch.sln)
2. Highlighted ProjectSearch (the project) in Solution Explorer and
then selected Project >
Copy Project from the menu. The dialogue box shows
http://myservername/webprojects/ProjectSearch
as the source project folder and I entered
http://myservername/webprojects/ProjectSearchUpdate
as the destination project folder, using the File share web access
method and the path
\\myservername\wwwroot$\webprojects\ProjectSearchUpdate and selected
copy 'All project files'.
3. I closed the solution.
4. Using windows expolorer I opened ProjectSearch.vbproj.webinfo and
the URL path seems to
be correct:
<VisualStudioUNCWeb>
<Web URLPath =
"
http://myservername/webprojects/ProjectSearchUpdate/ProjectSearch.vbproj"
/>
</VisualStudioUNCWeb>
5. From windows explorer I double-clicked the ProjectSearch.vbproj
file, which brought up
Visual Studio.
6. I with ProjectSerach now showing in Solution Explorer I selected
Build solution, which
prompted me with a 'Save As' dialogue box for the solution with a
suggested name
ProjectSearch.sln (in the same file as the ProjectSearch.vbproj). I
accepted this. And the
Build output was 'Build: 1 succeeded, 0 failed, 0 skipped'
7. I selected menu command Debug > Run and was warned to specify a
Start Page. I built the
project again, and recived an error message (full error message below
as error message 1):
Server Error in '/webprojects/ProjectSearchUpdate' Application.Access
to the path
"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\webprojects_projectsearchupdate\3890ab9b\9b033cb4" is denied.
8. I checked IIS to make sure virtual directory is configured as an
application. (It was)
9. I opened the web.config file and noted the following:
<authentication mode="Windows" />
<identity impersonate="true" userName="Corpdomain\ProjectSearchUser"
password="secretpassword"/>
I checked security on the directory both for the project and in the
temp files as indicated in the error message. The directory idicated
("C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\webprojects_projectsearchupdate\3890ab9b\9b033cb4") didn't
exists, yet the ASP.NET machine account had priveledges. I looked back
at the impersonate line in web.config and realized I needed to add the
ProjectSearchUser account to the Temporary ASP.NET Files top level so
it could create the folders and files needed for the project copy.
10. Built again. Lo and behold. IT WORKED!!! WOOT!
Error Message 1
===============
Server Error in '/webprojects/ProjectSearchUpdate' Application.
--------------------------------------------------------------------------------
Access to the path
"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\webprojects_projectsearchupdate\3890ab9b\9b033cb4" is denied.
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: System.UnauthorizedAccessException: Access to the
path
"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\webprojects_projectsearchupdate\3890ab9b\9b033cb4" is denied.
ASP.NET is not authorized to access the requested resource. Consider
granting access rights
to the resource to the ASP.NET request identity. ASP.NET has a base
process identity
(typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that
is used if the
application is not impersonating. If the application is impersonating
via <identity
impersonate="true"/>, the identity will be the anonymous user
(typically IUSR_MACHINENAME)
or the authenticated request user.
To grant ASP.NET write access to a file, right-click the file in
Explorer, choose
"Properties" and select the Security tab. Click "Add" to add the
appropriate user or group.
Highlight the ASP.NET account, and check the boxes for the desired
access.
Source Error:
An unhandled exception was generated during the execution of the
current web request.
Information regarding the origin and location of the exception can be
identified using the
exception stack trace below.
Stack Trace:
[UnauthorizedAccessException: Access to the path
"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\webprojects_projectsearchupdate\3890ab9b\9b033cb4" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String
path) +632
System.IO.Directory.CreateDirectory(String path) +195
System.Web.Compilation.PreservedAssemblyEntry.DoFirstTimeInit(HttpContext
context) +85
System.Web.Compilation.PreservedAssemblyEntry.EnsureFirstTimeInit(HttpContext
context)
+98
System.Web.Compilation.PreservedAssemblyEntry.GetPreservedAssemblyEntry(HttpContext
context, String virtualPath, Boolean fApplicationFile) +28
System.Web.UI.TemplateParser.GetParserCacheItemFromPreservedCompilation()
+91
System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound) +148
System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath()
+125
System.Web.UI.TemplateParser.GetParserCacheItem() +87
System.Web.UI.ApplicationFileParser.GetCompiledApplicationType(String
inputFile,
HttpContext context, ApplicationFileParser& parser) +171
System.Web.HttpApplicationFactory.CompileApplication(HttpContext
context) +43
System.Web.HttpApplicationFactory.Init(HttpContext context) +485
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +170
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
+414