1

I develop a web app locallly using US globalization. So the web.config looks like:

<system.web>
    ...
    <globalization culture="en-US" uiCulture="en-US" />
    <!--<globalization culture="no" uiCulture="no" />-->
    ...
</system.web>

I have two separate Azure web apps to which I deploy the app. I set the connection strings and the app settings directly in the azure management portal which I find ok, since I had to do this just once. The problem is that there is no option to set the globalization element in the management portal and the deploy always rewrites it back to US (the wanted value is no - norwegian, not that it matters, it simply should be different than US).

Is there a way to handle it either using the azure portal (a better solution imho) or using a deploy script? If so, then how?

1

1 Answer 1

1

You could implement this using a custom deployment script: http://blog.amitapple.com/post/38417491924/azurewebsitecustomdeploymentpart1/#.Vh5_QXmFMaU

One way to make the custom deployment script do what you want would be to have an app setting you define in your Norwegian site (via the portal) set to "Location = 'Norway'". Then in your custom deployment script you check to see if the app setting is set to Norway (it'll be available as an environment variable).

If it is, then you override the web config with the Norway globalization setting. There are multiple ways you could implement this part.

If the location is not defined or is set to US, then you leave it with the default US settings.

3
  • So far I deploy using VS Publish/WebDeploy, so I guess the custom deployment script would ahve to be a bit different. Ad overriding web.config: Is there another way then XSLT?
    – Santhos
    Oct 14, 2015 at 16:43
  • @Santhos, If you don't want to go the XSLT route, one option is to create a second web.config (e.g., web.config.norway) and just override the main web.config with the Norway version. Another could be to do a custom search/replace in the web.config, but that could break easily.
    – Zain Rizvi
    Oct 14, 2015 at 17:20
  • 1
    @Santhos Also, you can download the current deployment script for your site from https://<sitename>.scm.azurewebsites.net/api/deploymentscript and just add the code to modify your web.config to it
    – Zain Rizvi
    Oct 14, 2015 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.