![](/img/trans.png)
[英]Using Manifest gives an error 'parameter is not recognized' from MSDeploy.exe
[英]Run msdeploy.exe from under DefaultAppPool produces weird behaviour
我有這個ASP.NET Web應用程序,我想為其用戶提供一種通過POST請求通過zip文件更新該應用程序的方法,該文件包含該應用程序的較新版本。
成功接收,存儲和使用zip文件時,我發現msdeploy.exe
程序無法正常工作,這意味着我的應用程序沒有得到更新。
我正在使用以下命令行語法:
msdeploy -verb:sync -source:package={0} -dest:auto -enableRule:DoNotDeleteRule
(其中{0}被替換為zip文件的完整路徑)
雖然通過Windows©Shell手動成功安裝了更新, msdeploy
從Web應用程序啟動msdeploy
沒有這樣做 。 我正在使用的代碼:
ProcessStartInfo info = new ProcessStartInfo()
{
FileName = Path.Combine(workingDir, "msdeploy.exe"),
WorkingDirectory = workingDir,
CreateNoWindow = true,
Arguments = @"-verb:sync -source:package={0} -dest:auto -enableRule:DoNotDeleteRule -verbose".Formatted(filename.Enquote()),
UseShellExecute = false,
RedirectStandardOutput = true,
};
Process deploy = Process.Start(info);
deploy.Start();
我已將程序的輸出重定向到一個文件中,因此可以將其與理想的文件進行比較,即一種實際可行的手動方法。
有效的msdeploy
輸出(通過我的Windows帳戶+ Windows Shell運行):
Info: Updating file (Default Web Site/ElQueue\bin\AutoMapper.dll).
Info: Updating file (Default Web Site/ElQueue\bin\Contracts.dll).
...
Info: Updating file (Default Web Site/ElQueue\Views\Web.config).
Info: Updating file (Default Web Site/ElQueue\Web.config).
Info: Adding ACL's for path (Default Web Site/ElQueue)
Info: Adding ACL's for path (Default Web Site/ElQueue)
Total changes: 27 (1 added, 0 deleted, 26 updated, 0 parameters changed, 803122 bytes copied)
msdeploy
輸出msdeploy
(通過Process.Start
運行,因此是IIS AppPool \\ DefaultAppPool IIS的虛擬帳戶):
Warning: BACKUP_FAILED - Skipping backup because it failed due to an unknown reason.яFor more information, contact your server administrator.
Info: Adding sitemanifest (sitemanifest).
Info: Creating application (Default Web Site/ElQueue)
就這樣。 不多。 沒有文件更新,什么都沒有。 應用程序的文件保持不變。
我以為msdeploy是這樣,但是它似乎無法與默認的IIS應用程序池一起使用。
您如何驗證您的用戶? 如果是Windows身份驗證,最好的選擇是配置Web部署委托規則 。 使您的池帳戶身份成為本地管理員的一部分可能會遇到嚴重的安全問題。
通過使用lusrmgr.msc
管理控制台工具將IIS AppPool\\DefaultAppPool
用戶添加到Administrators
組中來解決此問題,然后在此之后重新啟動。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.