![msdeploy 同步问题](https://linux22.com/image/798555/msdeploy%20%E5%90%8C%E6%AD%A5%E9%97%AE%E9%A2%98.png)
我有 4 台 Windows 2008 R2 服务器。其中 3 台是 IIS 7.5 Web 服务器,1 台是 SQL 服务器/共享文件服务器。我完全按照自己的需要配置了第一台 Web 服务器,然后使用此 msdeploy 命令将配置同步到其他 2 台 Web 服务器。
msdeploy -verb:sync -source:webserver,computername=http://www1.server.com:8080/MSDeploy -dest:webserver,computername=http://www2.server.com:8080/MSDeploy
msdeploy -verb:sync -source:webserver,computername=http://www1.server.com:8080/MSDeploy -dest:webserver,computername=http://www3.server.com:8080/MSDeploy
这成功将配置推送到其他 Web 服务器。它们工作正常,只是无法连接到我设置的虚拟目录。如果我再次运行同步,你会看到它说它正在跳过虚拟目录(即使它实际上在目标机器上创建了它们)
Info: Using ID 'd9baab2a-4798-4760-8e09-24558cf6edd4' for connections to the remote server.
Info: Using ID 'e5389a2a-6925-425a-8d2c-fa8d8ae00727' for connections to the remote server.
Warning: Skipping source dirPath (\\server\Upload) because of rule SkipInvalidSource.
Could not find directory '\\server\Upload'.
Warning: Skipping source dirPath (\\server\FileSystem) because of rule SkipInvalidSource.
Could not find directory '\\server\FileSystem'.
Warning: Skipping source dirPath (\\server\Configuration) because of rule SkipInvalidSource.
Could not find directory '\\server\Configuration'.
Warning: Skipping source dirPath (\\server\SharedContent) because of rule SkipInvalidSource.
Could not find directory '\\server\SharedContent'.
Info: Object configProtectedData (MSDeploy.webServer/webServer/appHostConfig[@path='']/location[@path='']/section[@name='configProtectedData']/configProtectedData) skipped due to skip directive 'ConfigProtectedData'.
Info: Object configProtectedData (MSDeploy.webServer/webServer/machineConfig32[@path='/']/location[@path='']/configProtectedData) skipped due to skip directive 'ConfigProtectedData'.
Info: Object configProtectedData (MSDeploy.webServer/webServer/machineConfig64[@path='/']/location[@path='']/configProtectedData) skipped due to skip directive 'ConfigProtectedData'.
Info: Using ID '231d358c-292f-435d-8026-3158d8ed5c6b' for connections to the remote server.
Warning: Skipping source dirPath (\\server\Upload) because of rule SkipInvalidSource.
Could not find directory '\\serverl\Upload'.
Warning: Skipping source dirPath (\\server\FileSystem) because of rule SkipInvalidSource.
Could not find directory '\\serverl\FileSystem'.
Warning: Skipping source dirPath (\\server\Configuration) because of rule SkipInvalidSource.
Could not find directory '\\server\Configuration'.
Warning: Skipping source dirPath (\\server\SharedContent) because of rule SkipInvalidSource.
Could not find directory '\\server\SharedContent'.
Info: Object configProtectedData (MSDeploy.webServer/webServer/appHostConfig[@path='']/location[@path='']/section[@name='configProtectedData']/configProtectedData) skipped due to skip directive 'ConfigProtectedData'.
Info: Object configProtectedData (MSDeploy.webServer/webServer/machineConfig32[@path='/']/location[@path='']/configProtectedData) skipped due to skip directive 'ConfigProtectedData'.
Info: Object configProtectedData (MSDeploy.webServer/webServer/machineConfig64[@path='/']/location[@path='']/configProtectedData) skipped due to skip directive 'ConfigProtectedData'.
Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes copied)
我需要获取其他两台服务器,以便它们能够连接到虚拟目录。我尝试重新输入虚拟目录的凭据,删除虚拟目录并手动设置,删除整个站点并手动设置。所有这些操作都失败了。这几乎就像 msdeploy 破坏了我的 IIS 安装。我在系统上的站点目录上运行了比较,它们是相同的。我比较了 c:\Windows\System32\inetsrv\config\applicationHost.config,除了虚拟目录的哈希密码外,它们是相同的。
IIS 安装表明他们安装了相同的角色服务。
解决这个问题的最大线索是应用程序错误日志。两台不工作的服务器在编译网站时会抛出此警告消息。它在虚拟目录中寻找 web.config。这让我相信它认为虚拟目录实际上是一个应用程序。我在配置设置中没有看到这一点。
Event code: 3008
Event message: A configuration error has occurred.
Event time: 1/21/2013 4:28:46 PM
Event time (UTC): 1/21/2013 9:28:46 PM
Event ID: 036c3591338f4f84aaac84e68c4f7753
Event sequence: 35
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/ROOT-2-130032773103912852
Trust level: Full
Application Virtual Path: /
Application Path: D:\sites\server.com\
Machine name: S615516NJ3VW02
Process information:
Process ID: 4136
Process name: w3wp.exe
Account name: IIS APPPOOL\server.com
Exception information:
Exception type: ConfigurationErrorsException
Exception message: An error occurred loading a configuration file: Failed to start monitoring changes to '\\server\Upload' because access is denied. (\\server\Upload\web.config)
Request information:
Request URL: http://www2.server.com/Upload/Flash/history.swf
Request path: /Upload/Flash/history.swf
User host address: xxx.xxx.xx.35
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\server.com
Thread information:
Thread ID: 6
Thread account name: IIS APPPOOL\server.com
Is impersonating: False
Stack trace: at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_Identity()
at System.Web.HttpContext.SetImpersonationEnabled()
at System.Web.HttpApplication.AssignContext(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
感谢您帮助解决此问题。
答案1
我自己修复了这个问题。MSDeploy 完全搞砸了目标 IIS 安装。我运行了文件比较,源和目标之间的所有内容都相同,但问题仍然存在。我卸载并重新安装了 IIS。这让 IIS 再次工作。然后我找到了下面关于 -disableLink 选项的文章。-disableLink:ContentExtension 告诉它不要同步虚拟目录。该开关赢得了“不明显”奖...
答案2
我的情况可能更简单:我将 msdeploy 命令放入错误的 RDP 窗口,然后应用程序试图将数据传输给自身。
这是艰难的一周中艰难的星期五。