【问题标题】:using msdeploy.exe to deploy folder to remote site使用 msdeploy.exe 将文件夹部署到远程站点
【发布时间】:2017-03-17 05:49:10
【问题描述】:

我正在尝试为 msdeploy 找到正确的参数。 我有一个包含我想要部署的 Web 内容的文件夹。

"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3"\msdeploy.exe -verb:sync -source:contentPath="c:\work\WebPackage" -dest:contentPath="Default Web Site",computername="http://10.7.5.93",username='\localuser',password=aPassword

我收到此错误:

Error Code: ERROR_DESTINATION_NOT_REACHABLE
More Information: Could not connect to the remote computer ("10.7.5.93"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Deployment Agent Service") is started.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.
Error: Unable to connect to the remote server
Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.7.5.93:80
Error count: 1.

无法找出正确的语法。我可以使用这个发布文件从 VS 部署:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>https://kitostest.miracle.dk</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <MSDeployServiceURL>http://10.7.4.93</MSDeployServiceURL>
    <DeployIisAppPath>Default Web Site</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>\deploy</UserName>
    <_SavePWD>True</_SavePWD>
    <PrecompileBeforePublish>True</PrecompileBeforePublish>
    <EnableUpdateable>True</EnableUpdateable>
    <DebugSymbols>False</DebugSymbols>
    <WDPMergeOption>DonotMerge</WDPMergeOption>
    <PublishDatabaseSettings>
      <Objects xmlns="">
        <ObjectGroup Name="KitosContext" Order="1" Enabled="False">
          <Destination Path="" />
          <Object Type="DbCodeFirst">
            <Source Path="DBMigration" DbContext="Infrastructure.DataAccess.KitosContext, Infrastructure.DataAccess" MigrationConfiguration="Infrastructure.DataAccess.Migrations.Configuration, Infrastructure.DataAccess" Origin="Configuration" />
          </Object>
        </ObjectGroup>
      </Objects>
    </PublishDatabaseSettings>
  </PropertyGroup>
  <ItemGroup>
    <MSDeployParameterValue Include="$(DeployParameterPrefix)KitosContext-Web.config Connection String" />
  </ItemGroup>
</Project>

部署参数的屏幕截图:

所以我需要找到一种方法将参数映射到 msdeploy。

这是我上次的尝试:

"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3"\msdeploy.exe -whatif -verb:sync -source:contentPath="C:\work\WebPackage" -dest:contentPath='M:\Website',ComputerName="http://10.7.5.93/msdeploy.axd?site=Default Web Site",UserName='\ALocalUser',Password='MyPassWord',AuthType='Basic'

Syntak 取自文章How to publish the contents of a folder with msdeploy.exe contentPath 的语法

我让它工作了!!!在进行 Web 部署时,我使用 fiddler 来监视 Visual Studio。它把我的网站称为 site/MSDEPLOYAGENTSERVICE 而不是 site/msdeploy.axd。我不是在 Web 服务器上安装 msdeploy 的人,但如果我 read the manual 则可以为自己节省 5 个小时的挫败感。

【问题讨论】:

    标签: msdeploy


    【解决方案1】:

    好像没有“默认网站”?尝试添加您发布到的网站名称:

    msdeploy.exe -verb:sync -source:contentPath="..\WebPackage" -dest:auto,computername="http://10.7.5.93/msdeploy.axd?site=name_of_your_site",username=aUserName,password=aPassword 
    

    取决于内容的创建方式,您可能需要在 msdeploy 行中进行其他更改,但我会先尝试。

    【讨论】:

    • David Aleu 非常接近。我不得不使用 MSDEPLOYAGENTSERVICE 而不是 msdeploy.axd 并且 msdeploy 不能使用相对路径。必须将“..\path”更改为“c:\path”
    猜你喜欢
    • 1970-01-01
    • 2013-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-06
    • 1970-01-01
    相关资源
    最近更新 更多