I've read a few posts on this error but they've mainly been focused on the development environment, rather than the production environment that I was encountering the issue on. Our scenario is one in which we have discovered the wonders of Git Deploy and the massive time saving association (kudos to Kudu and David Ebbo et al.) that comes with using an Azure Website as opposed to a Web Role within a Cloud Service (a good comparison of the available options can be found here).
Enter Blob Storage, Exit Working Website
Everything was going well until we brought Blob Storage into the equation. The site was running fine locally, the Azure Compute and Storage emulators had been spun up by Visual Studio running as Administrator, so no problems there. Another speedy git deployment (not that I'm a fan or anything) and then wallop. 'Not running in a hosted service or the Development Fabric' when trying to access CloudConfigurationManager.GetSetting
. Some general Googling and reading various Stack Overflow posts lead me to the understanding that an Azure Website is effectively Shared Hosting, and as such doesn't run as a dedicated hosted service. There's no ServiceDefinition
config
so no direct way to access Blob Storage.
By changing the Web Role to be a WCF service purely focused on reading from and writing to Blob Storage instead of the Azure Website as we initially had it set up before getting on to the Git Deployment goodness, we could abstract the communication with Blob Storage away from the Website. It's still painful to publish the WCF Web Role, so we'll probably make use of the Web Accelerator for Web Roles, a useful project on Github.
To sum up, Azure Websites are great for getting a site spun up and deployed quickly provided that you don't need to use Blob/Table/Queue storage, which requires either a Web Role or a site hosted within an Azure VM. Communication with SQL Azure is fine from a Website as it's just a bog standard connection string. In our scenario, a Web Role hosting a WCF service works just fine.
View original article