检查您的 %UserProfile%\AppData\Local\Temp 目录。您应该在那里看到几个文件,包括 IISConfigurator.log
对于 SDK v1.6 的我来说,路径是 %UserProfile%\AppData\Local\dftmp\IISConfiguratorLogs\IISConfigurator.log(请注意最新的 SDK, 看起来他们已经改变了路径)
问题出在 'Adding access to users IUSR and NT AUTHORITY\NETWORK SERVICE to path %MyPathOnTheBuildMachine%'这一行:
IISConfigurator Information: 0 : [00004816:00000004, 2011/12/08 13:01:51.971] Adding access to users IUSR and NT AUTHORITY\NETWORK SERVICE to path %MyPathOnTheBuildMachine%
IISConfigurator Information: 0 : [00004816:00000004, 2011/12/08 13:01:51.972] Caught exception
IISConfigurator Information: 0 : [00004816:00000004, 2011/12/08 13:01:51.974] Exception:System.InvalidOperationException: Method failed with unexpected error code 3.
at System.Security.AccessControl.NativeObjectSecurity.CreateInternal(ResourceType resourceType, Boolean isContainer, String name, SafeHandle handle, AccessControlSections includeSections, Boolean createByName, ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext)
at System.Security.AccessControl.DirectorySecurity..ctor(String name, AccessControlSections includeSections)
at System.IO.DirectoryInfo.GetAccessControl(AccessControlSections includeSections)
at Microsoft.WindowsAzure.ServiceRuntime.IISConfigurator.FileManager.AddAllowAceIterative(DirectoryInfo dir, FileSystemRights rights, IdentityReference[] accounts)
at Microsoft.WindowsAzure.ServiceRuntime.IISConfigurator.FileManager.AddAllowAce(DirectoryInfo dir, FileSystemRights rights, Boolean inherit, IdentityReference[] accounts)
at Microsoft.WindowsAzure.ServiceRuntime.IISConfigurator.Security.AddAppPoolSidAceToVdir(String appPoolName, String sitePath, String appPoolSid)
at Microsoft.WindowsAzure.ServiceRuntime.IISConfigurator.IISConfigurator.Deploy(String roleId, WebAppModel appModel, String roleRootDirectory, String sitesDestinationDirectory, String diagnosticsRootFolder, String roleGuid, Dictionary`2 globalEnvironment)
原来我在一台机器上打包(cspack)我的解决方案,但试图在另一台机器上运行它(csrun)。因此,它试图授予对一台机器上存在但另一台机器上不存在的目录的权限。
很多人确定您在同一台机器上 cspack 和 csrun 您的代码(例如,当您进行自动构建和部署时可能不是这种情况)。