Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 06, 2012 12:22 PM by mattquinnuk
Jul 04, 2012 11:57 PM|LINK
I have these standard appSettings in web.config and I don't know how to migrate them over as I do not call them myself in code.
<add key="ClientValidationEnabled" value="true" />
Do I just ignore these or...?
Jul 05, 2012 01:25 AM|LINK
These are for MVC's internal plumbing. One enables client validation by default (you used to have to explicitly enable this in code) and the other chooses what style of client validation to use -- MVC2 or MVC3 style. "true" means do the newer MVC3 style.
Jul 05, 2012 01:27 AM|LINK
Thank you I didn't know that. However, the question and concern is that they are in the web.config and Azure does not use web.config for appSettings. What do I need to do to get these to work in Azure?
Jul 06, 2012 12:22 PM|LINK
Azure does support web.config.
In effect a web role is just a virtualised Windows Server running IIS.
Therefore your web.config is still used by the ASP.NET web application running on it- you just can't change anything in here without redeploying the whole site.
If it's something that doesn't change at runtime / without you changing some code anyway, you can leave it in web.config and it'll be deployed along with all the content and DLLs as part of your site.
If it's something you want to be able to change without redeploying the Role you can use the RoleEnvironment.GetSetting() to pull configuration settings from your Role Settings. This is a combination of adding a setting to your ServiceDefinition file, defining
it's value in ServiceConfiguration and then calling RoleEnvironment.GetSetting() within your code to retrieve the current value.