首页 > 解决方案 > Web Deploy automatic backup is empty when using dotnet publish

问题描述

I am using web deploy to publish my .net core 3.1 web app to my server, which is working fine so far. Now I want to setup automatic backup before any new deployments. I followed this manual.

I've also added <EnableMSDeployBackup>True</EnableMSDeployBackup> to my .pubxml file. When I initiate a deployment with dotnet publish ... The console output tells that a backup will be created. No errors are reported. And actually there is a package zip-file at the defined backup location, but the content folder does not contain anything, there is only an archive.xml and systemInfo.xml file in the root of the zip.

When I perform the backup using msdeploy.exe -verb:sync -source:backupManager -dest:backupManager=siteName directly on the server, the backup is created properly. For testing I'm using the same user for remote-publish who is administrator on the server and has full rights in the source as well as in the destination folder.

The behaviour is the same when publishing from within Visual Studio 2019.

I've already found some similar questions here and here but none of the recommended solutions work.

My .pubxml looks like this (mostly created from VS):

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <EnvironmentName>Production</EnvironmentName>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>https://my-server/myapp</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <TargetFramework>net461</TargetFramework>
    <RuntimeIdentifier>win7-x86</RuntimeIdentifier>
    <ProjectGuid>3ae552b0-7f3a-42b9-b224-d5c734004215</ProjectGuid>
    <MSDeployServiceURL>https://my-server/</MSDeployServiceURL>
    <DeployIisAppPath>MyApp</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>ourDomain\myUser</UserName>
    <_SavePWD>True</_SavePWD>
    <PublishDatabaseSettings>
      <Objects xmlns="" />
    </PublishDatabaseSettings>
    <ExcludeFilesFromDeployment>appsettings.Development.json</ExcludeFilesFromDeployment>
  </PropertyGroup>
</Project>

Any ideas will be appreciated!

标签: .netvisual-studiowebdeploy

解决方案


推荐阅读