"SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used" when trying to execute a command from the prompt on an Azure environment

Topics: Customizing Orchard, General, Troubleshooting
Oct 29, 2013 at 4:33 PM
I'm still using Orchard 1.6, and have just spent a bit of time investigating why we are seeing the above error whenever we try to run commands from the command line interface against certain tenants deployed on an Azure Environment.

It turns out that the reason for this is that the call to CloudStorageAccount.SetConfigurationSettingPublisher is made in Application_Start in Global.asax. This is fine in an HttpContext, but means that this line never gets called in the context that the command line runs in. The result of this is that we can't use the Command Prompt for any tenants that have a feature enabled that makes use of IStorageProvider.

I'm currently trying to put together an argument for my employer to move one of our largest projects over to 1.7.1. Is anyone able to confirm whether or not this bug has been fixed in 1.7.1?

I had a look at the source on CodePlex and that call no longer appears in Application_Start (although I couldn't find it anywhere else either), so it appears that the way this is initialized has at least been changed.
Developer
Oct 29, 2013 at 5:33 PM
Yes, that initialization code is obsolete in newer versions of the Azure SDK, and has been removed. It should work fine in 1.7.1, although I have not confirmed.