简体   繁体   中英

Apply applicationHost transform when deploying to Azure Cloud Service

I am deploying in Azure using Cloud Service. I need to add global url rewrite rule in each of the nodes. 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.

I've prepared my applicationHost.xdt file - but how do I get this transform to run when deploying the cloud service?

Note, there are plenty of examples/articles that describe how to deploy/run it in azure application service. 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)? As far as I know it isn't a generic applicationHost.config transform for use outside of Web Apps.

For cloud services you would use a startup task to automate appcmd commands. For example - 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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