【问题标题】:Apply applicationHost transform when deploying to Azure Cloud Service部署到 Azure 云服务时应用 applicationHost 转换
【发布时间】:2018-10-22 09:44:50
【问题描述】:

我正在使用云服务在 Azure 中进行部署。我需要在每个节点中添加全局 url 重写规则。这些全局改写规则保存在applicationHost.config文件中,按照我的阅读方式,这个文件可以使用xml转换的方式进行修改。

我已经准备好我的 applicationHost.xdt 文件 - 但是在部署云服务时如何让这个转换运行?

请注意,有很多示例/文章描述了如何在 azure 应用程序服务中部署/运行它。我需要在云服务中进行,这是不同的。

【问题讨论】:

    标签: azure azure-cloud-services applicationhost


    【解决方案1】:

    applicationHost.xdt 不是仅适用于应用服务环境(即 Web 应用)吗?据我所知,它不是用于 Web 应用之外的通用 applicationHost.config 转换。

    对于云服务,您将使用启动任务来自动执行 appcmd 命令。例如——https://docs.microsoft.com/en-us/azure/cloud-services/cloud-services-startup-tasks-common#block-a-specific-ip-address:

    @echo off
    @echo Installing "IPv4 Address and Domain Restrictions" feature 
    powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Web-IP-Security"
    @echo Unlocking configuration for "IPv4 Address and Domain Restrictions" feature 
    %windir%\system32\inetsrv\AppCmd.exe unlock config -section:system.webServer/security/ipSecurity
    

    【讨论】:

    • 很有可能,因为我不知道如何在我的情况下使用它。最后我确实使用了启动脚本。我已经有一个在启动时执行的 powershell 脚本 - 我只是在其中添加了相应的命令。
    猜你喜欢
    • 2015-08-31
    • 1970-01-01
    • 2014-12-13
    • 2013-08-19
    • 2020-09-22
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 2012-09-05
    相关资源
    最近更新 更多