从命令提示符使用msbuild时出错ERROR_COULD_NOT_CONNECT_TO_REMOTESVC

时间:2015-11-11 20:07:33

标签: azure msbuild azure-web-sites publish-profiles

我正在尝试使用命令行中的msbuild工具部署我的webproject,如下所示 -

  

msbuild MyWebProject.vbproj / p:DeployOnBuild = true   / p:PublishProfile =" MyWebProject - Web Deploy - Test"   / P:配置=调试

但是我收到了以下错误 -

  

msdeploy错误ERROR_COULD_NOT_CONNECT_TO_REMOTESVC:Web部署任务失败。 (无法使用指定的进程(" Web管理服务")连接到远程计算机(" MyWebProject.scm.azurewebsites.net"),因为服务器没有响应。请确保该过程(" Web管理服务")在远程计算机上启动。了解更多信息:http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC。)[C:\ XXXX \ XXXX \ MyWebProjectSolution \ MyWebProject \ MyWebProject.Web.vbproj]

以下是我正在使用的发布配置文件 -

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<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>http://MyWebProject.azurewebsites.net/tMyApp</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <MSDeployServiceURL>MyWebProject.scm.azurewebsites.net:443</MSDeployServiceURL>
    <DeployIisAppPath>MyWebProject/tMyApp</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>$MyWebProject</UserName>
    <_SavePWD>True</_SavePWD>
    <_DestinationType>AzureWebSite</_DestinationType>
    <PublishDatabaseSettings>
        ......
    </PublishDatabaseSettings>
  </PropertyGroup>
  <ItemGroup>
    <MSDeployParameterValue Include="$(DeployParameterPrefix)MyWebProjectDB-Web.config Connection String">
      <UpdateDestWebConfig>False</UpdateDestWebConfig>
    </MSDeployParameterValue>
  </ItemGroup>
</Project>

当我使用相同的发布配置文件手动发布我的网络应用程序时,它可以正常工作。

这是msbuild发出的请求和响应(使用fiddler捕获) -

------- Raw Request -----
CONNECT MyWebProject.scm.azurewebsites.net:443 HTTP/1.1
Host: MyWebProject.scm.azurewebsites.net
Proxy-Connection: Keep-Alive
------- Auth -----
No Proxy-Authorization Header is present.
No Authorization Header is present.

------- Raw Response -----
HTTP/1.1 0 Connection passed to Gateway - Result unknown
EndTime: 10:26:35.164

请参阅下面的图片,了解小提琴请求的详细信息。enter image description here

知道我的msbuild命令可能出了什么问题吗?

1 个答案:

答案 0 :(得分:0)

我遇到了这个问题,对我来说解决方法是将我的 ip 添加到 SCM 站点限制:

Azure portal -> Your app service -> Networking -> Configure Access Restrictions -> scm tab -> Add rule

https://docs.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions#restrict-access-to-an-scm-site