简体   繁体   中英

Umbraco deployment to Azure

I just created a website in vstudio 2017 and added Umbracocms Nuget package. I also added uSync, made some configuration, design and so on, then I published the site to Azure. Before publishing, I modified my web.config to be sure to force the wizard to fire. Therefore, I could configure my Sql Azure database and now the site works like a charm.

No, I'm thinking about future update... To be able to continue to develop the site on my local machine, I had to revert my web.config to use the SDF file, so what will happen for the next deployment on Azure ? I guess that the web.config file will be in the package, so it will replace the one on Azure.

So either, I always clear the keys to force the wizard to run, or I don't and then I guess my site will go down because it won't be using the SQL Azure database anymore.

What's the solution for this? How can I update my site on Azure seamlessly? In my mind, I would just have to click on "Publish", then, the site gets uploaded on Azure, uSync ensure the changes I made are synchronized and that's it.

Depending on how you deploy the site you will either want to use Web.Config Transformations AND configure Visual Studio's Publish settings.

You should already have a Web.Config and a Web.Release.Config.

In Web.Config you will have:

<connectionStrings>
    <remove name="umbracoDbDSN" />
    <add name="umbracoDbDSN" connectionString="your local connection string" providerName="System.Data.SqlClient" />
</connectionStrings>

Then in Web.Release.Config you will want to have:

<connectionStrings>
    <add name="umbracoDbDSN"
         connectionString="your production connection string" 
         providerName="System.Data.SqlClient"
         xdt:Transform="SetAttributes"
         xdt:Locator="Match(name)" />
</connectionStrings>

In your publish profile you can then set the configuration to release. When you do so you will also notice umbracoDbDSN show up with an empty textbox. In my experience it is best to also put the connection string from Web.Release.Config in there and check "Use this connection string at runtime".

This extra transformation gets applied after the transformations in Web.Release.config and will overwrite them. Historically this interface has been a bit buggy and has been known to wipe out connection strings if it's not explicitly set.

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