简体   繁体   中英

Run msdeploy.exe from under DefaultAppPool produces weird behaviour

Intro

I have this ASP.NET web app and I'd like to provide its users a way to update the app via POST request with zip file which contains the newer version of the app.

While successefully receiving, storing and using the zip file, I found that msdeploy.exe program does not work, meaning my app is not getting updated.

I am using the following command line syntax:

msdeploy -verb:sync -source:package={0} -dest:auto -enableRule:DoNotDeleteRule

(where {0} is replaced by enquoted full path to the zip file)

The issue

While successefully installing the update via Windows© Shell manually, I fail to do so when I start msdeploy from withing my web application. The code I'm using:

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();

Debugging attempts

I have redirected the program's output into a file so I could compare it to the ideal one, the manual way one which actually works.

Working msdeploy output (run via my windows account + 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)

Non-working msdeploy output (run via Process.Start hence IIS AppPool\\DefaultAppPool IIS' virtual account):

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)

And, that's all. Not much. No file updates, no nothing. The application's files remain unchanged.

SO, how to update my web app the right way ?

I thought msdeploy is the way, but its seems not to work with default IIS app pool.

How do you authenticate your users? If it's Windows authentication the best option would be to configure Web deployment delegation rule . Making your pool account identity part of local Administrators may have serious security issues.

通过使用lusrmgr.msc管理控制台工具将IIS AppPool\\DefaultAppPool用户添加到Administrators组中来解决此问题,然后在此之后重新启动。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM