Monday, November 8, 2010

Error creating a Project Site Template

SymtpomsWhen creating a site template for a Project Server 2010 Site Template, you receive a correlation error with out any useful error message. Looking further into the SharePoint ULS logs the following error message is found.

Error  Messages
SharePoint throws a site error and display a correlation ID

Error
An unexpected error has occurred.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: f8145bf3-b9f3-441a-987b-75c13cca85c8
Date and Time: 8/11/2010 6:50:50 PM


The following error can also be found in the SharePoint ULS Logs.

SPSolutionExporter: System.UnauthorizedAccessException: Access to the path 'C:\Temp\SPSolutionExporter-d15ec730-0b24-4767-a7c9-c032238a2253\20101103_SantosProjectSiteTemplateListInstances\Files\Lists\Risks\Schema.xml' is denied.   
 at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)   
 at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)   
 at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)   
 at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)   
 at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)   
 at System.IO.StreamWriter..ctor(String path)   
 at Microsoft.SharePoint.SPSolutionExporter.<>c__DisplayClass1b.<PerformContentFixupOnFile>b__19()   
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)   
 at Microsoft.SharePoint.SPSolutionExporter.PerformContentFixupOnFile(String fileFullPath)   
 at Microsoft.SharePoint.SPSolutionExporter.<>c__DisplayClass16.<PerformGuidFixupOnDirectory>b__15()   
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)   
 at Microsoft.SharePoint.SPSolutionExporter.<>c__DisplayClass16.<PerformGuidFixupOnDirectory>b__15()   
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)   
 at Microsoft.SharePoint.SPSolutionExporter.<>c__DisplayClass16.<PerformGuidFixupOnDirectory>b__15()   
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)   
 at Microsoft.SharePoint.SPSolutionExporter.<>c__DisplayClass16.<PerformGuidFixupOnDirectory>b__15()   
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)   
 at Microsoft.SharePoint.SPSolutionExporter.<>c__DisplayClass16.<PerformGuidFixupOnDirectory>b__15()   
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)   
 at Microsoft.SharePoint.SPSolutionExporter.ExportWebAsSolution()

Solution
This error is actually a security access issue. The account trying to access the C:\Temp path is actually an IIS application pool account. Not sure exactly which one but my logical guess would be the SharePoint one. Open IIS and check what application pool account SharePoint is running under. Then navigate to Right click the 'C:\Temp ' folder, select properties and click on the security tab. Click edit and add the IIS application pool account. I gave the account full access but you can test if still works with more restricted permissions. Once you apply these changes you should be able to create the site template without causing an error.