asp.net-mvc - 从 PowerShell 将 Azure 网站发布到非根文件夹

标签 asp.net-mvc deployment azure-web-app-service azure-powershell

我现在正在测试我的假设。我的 Asp.Net MVC 应用程序位于 www.myapp.com/app 上,第三方 CMS 系统位于 www.myapp.com/ 上。

该网站的设置如 this answer 中所述。

目前,我可以从 Visual Studio 中单独手动发布这两个应用程序,并且运行良好。

但是,我正在尝试从使用 Azure Power-Shell scriplet 的构建服务器发布我的应用程序:

PS> Publish-AzureWebsiteProject -Name myApp -Package MyWebDeployPackage.zip

但是,documentation没有提及是否可以使用此脚本发布到非根文件夹。

有什么方法可以从命令行将应用程序发布到 ~/app 吗?

UPD:我可以通过

msbuild 发布
msbuild .\SolutionName.sln /p:DeployOnBuild=true /p:PublishProfile=ProfileName /p:Password=passwordForAzurePublishing /p:AllowUntrustedCertificate=true

其中 ProfileName 是配置为部署到 Azure 网站的子文件夹的 Web 部署配置文件,Password 是 Azure 配置文件中的部署密码。

但这不是最佳解决方案:要部署到测试和生产环境,我需要构建应用程序两次,我想避免这种情况:如果我编译 View ,则需要 7-10 分钟(我们有800 次观看)。这样做两次是浪费时间。

UPD 2:在 Azure SDK 工具存储库上创建了一个问题:https://github.com/Azure/azure-sdk-tools/issues/2667

最佳答案

我认为这在 PowerShell 中是不可能的,但我可能是错的。在这里查看他们的发布代码 https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1136-L1168

还有这里https://github.com/Azure/azure-sdk-tools/blob/master/src/ServiceManagement/Services/Commands.Utilities/Websites/WebsitesClient.cs#L1218-L1229

它们没有应用程序名称参数,第二个链接中的代码手动构建网站名称/位置。

我想说在这里打开一个问题 https://github.com/Azure/azure-sdk-tools/issues为此,Azure PowerShell 团队的某个人应该看看它。

关于asp.net-mvc - 从 PowerShell 将 Azure 网站发布到非根文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24376643/

相关文章:

azure - 空的 Azure 应用服务计划需要付费吗?

Azure Docker compose 因环境部分而失败

asp.net-mvc - 如何创建将 IEnumerable<T> 绑定(bind)到表的 HtmlHelper 扩展方法

asp.net-mvc - 我在运行局部 View 时出错

c# - 将域模型子计数投影到 View 模型上,无需额外查询

ruby-on-rails - 在生产部署中将容器链接在一起

deployment - 如何通过 VSTS 版本定义覆盖 Windows 服务 .exe.config 文件中的键

c# - FileStreamResult 是否关闭 Stream?

go - 无法通过 kubectl logs 命令检索 go 客户端中的 POD 日志

java - Azure webapp HTTP 状态 404 – 未找到