简体   繁体   English

部署到Azure云服务时应用applicationHost转换

[英]Apply applicationHost transform when deploying to Azure Cloud Service

I am deploying in Azure using Cloud Service. 我正在使用Cloud Service在Azure中进行部署。 I need to add global url rewrite rule in each of the nodes. 我需要在每个节点中添加全局url重写规则。 These global rewrite rules are stored in the applicationHost.config file and the way I read it, this file can be modified using the xml transform method. 这些全局重写规则存储在applicationHost.config文件中,以及我读取它的方式,可以使用xml转换方法来修改此文件。

I've prepared my applicationHost.xdt file - but how do I get this transform to run when deploying the cloud service? 我已经准备了applicationHost.xdt文件-但是在部署云服务时如何使此转换运行?

Note, there are plenty of examples/articles that describe how to deploy/run it in azure application service. 注意,有很多示例/文章描述了如何在azure应用程序服务中部署/运行它。 I need to do it in a cloud service instead, which is different. 我需要在云服务中执行此操作,这是不同的。

Isn't the applicationHost.xdt only for App Service environments (ie. Web Apps)? applicationHost.xdt是否仅适用于App Service环境(即Web Apps)? As far as I know it isn't a generic applicationHost.config transform for use outside of Web Apps. 据我所知,它不是在Web Apps外部使用的通用applicationHost.config转换。

For cloud services you would use a startup task to automate appcmd commands. 对于云服务,您将使用启动任务来自动化appcmd命令。 For example - https://docs.microsoft.com/en-us/azure/cloud-services/cloud-services-startup-tasks-common#block-a-specific-ip-address : 例如-https : //docs.microsoft.com/zh-cn/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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM