Is there a way to customise the path to the umbraco.config file for reading/writing?
I know there is the umbracoContentXML setting that can be used in the web.config, but I need a way to set this path based on a variable that changes depending on the machine it is deployed to.
You could set up one for each environment you plan to deploy to since you would likely also have to also update things like the database connection string.
Hi Simon. Thanks for your reply but this won't work for what I need to do. With Azure, a site can be running on multiple machines in the same environment. I need a unique path based on the machine, and I think the only way I can do this is by injecting a computed value into the web.config app settings - which I don't think can be done. The only other option I can think of is customising the Umbraco build, which is something I want to avoid.
Unless I'm missing something. Is there a provider I can tap into, or a way I can set the path of the cache file programmatically?
Couldn't you hook into the application start event and pass in the setting then? I've done the same thing to append a reserved path, I'll see if I can find the code for you if you like?
On Umbraco 6.x there was a web.config setting called "umbracoContentXMLUseLocalTemp". If you set it to true, it saves the umbraco.config file into the webserver local temporary .net cache, not inside the web root.
It should work on 7.x too, it would need testing.
I'm not sure if this will work on Azure, but worth a try as it removes the need to specify the path for the cache file.
Thanks for your relpy. Yes I've seen this setting but not sure it will solve the issue we're having. Basically, we're having file locking issues where 2 or more Azure nodes, after auto scaling, try to access this file at the same time (this was reported to us by our DevOps guys so I don't have much more info).
So we need a way to locate the umbraco.config file in a folder based on a variable like the machine name which will not be known at the time of deployment.
I'm not an expert on Azure architecture but I will mention this solution to the DevOps and see what they say.
The trick is to remove the "working" files away from Azure's file system storage onto it's web worker process storage. Make sure you're on Umbraco 7.3+ as it has this all built in :)
There's a couple of interesting posts on Umbraco and Azure...
Many thanks for your replies guys. Jon, we don't think we can use the web.config editing solution as this will cause a website restart, but we'll look into it.
Interesting links Neil, thanks. Not working on this now, but will let you know my findings.
I completely understand the restart issue with the web.config but why not create your own config file somewhere and then read and write from that?
That way you have a unique repo of the id's you're getting but you don't have to query the system each time or restart the app pool with the web.config route.
Customising the path to umbraco.config
Hi
Is there a way to customise the path to the umbraco.config file for reading/writing?
I know there is the umbracoContentXML setting that can be used in the web.config, but I need a way to set this path based on a variable that changes depending on the machine it is deployed to.
Thanks in advance.
web.config Transformation?
https://msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx
You could set up one for each environment you plan to deploy to since you would likely also have to also update things like the database connection string.
Simon
Hi Simon. Thanks for your reply but this won't work for what I need to do. With Azure, a site can be running on multiple machines in the same environment. I need a unique path based on the machine, and I think the only way I can do this is by injecting a computed value into the web.config app settings - which I don't think can be done. The only other option I can think of is customising the Umbraco build, which is something I want to avoid.
Unless I'm missing something. Is there a provider I can tap into, or a way I can set the path of the cache file programmatically?
Couldn't you hook into the application start event and pass in the setting then? I've done the same thing to append a reserved path, I'll see if I can find the code for you if you like?
Hi Jon
Something like this is exactly what I need. I couldn't find how to do it though, so yes, if you have some code I'd love to see it.
Hi Mitch,
On Umbraco 6.x there was a web.config setting called "umbracoContentXMLUseLocalTemp". If you set it to true, it saves the umbraco.config file into the webserver local temporary .net cache, not inside the web root.
It should work on 7.x too, it would need testing.
I'm not sure if this will work on Azure, but worth a try as it removes the need to specify the path for the cache file.
Regards
Neil
Hi Neil
Thanks for your relpy. Yes I've seen this setting but not sure it will solve the issue we're having. Basically, we're having file locking issues where 2 or more Azure nodes, after auto scaling, try to access this file at the same time (this was reported to us by our DevOps guys so I don't have much more info).
So we need a way to locate the umbraco.config file in a folder based on a variable like the machine name which will not be known at the time of deployment.
I'm not an expert on Azure architecture but I will mention this solution to the DevOps and see what they say.
Thanks
No worries Mitch.
The trick is to remove the "working" files away from Azure's file system storage onto it's web worker process storage. Make sure you're on Umbraco 7.3+ as it has this all built in :)
There's a couple of interesting posts on Umbraco and Azure...
https://cultiv.nl/blog/making-sure-your-umbraco-site-performs-on-azure/
https://www.degree53.com/blog/2015/october/highly-scalable-solutions-using-umbraco-and-azure
Best of luck.
n
Mitch,
Deepest apologies! I've just finished up at Codegarden 16 so I wasn't checking things on here!
Here's the code I used, just ignore the package actions parts unless you need them, but I'm sure you can see the parts you need!
Let me know if there's any confusion and I'll see if I can answer them!
Again, apologies for the delay,
Jon
Many thanks for your replies guys. Jon, we don't think we can use the web.config editing solution as this will cause a website restart, but we'll look into it.
Interesting links Neil, thanks. Not working on this now, but will let you know my findings.
Mitch,
I completely understand the restart issue with the web.config but why not create your own config file somewhere and then read and write from that?
That way you have a unique repo of the id's you're getting but you don't have to query the system each time or restart the app pool with the web.config route.
Jon
is working on a reply...