I just found this one out thanks to this post from the Azure team.
Basically, I was configuring Table Storage (as you may have guessed, if you’ve read my other posts today), and using the CloudStorageAccount.FromConfigurationSetting(string) method. As you are probably aware (if you are aware of this sort of stuff), to be able to use that method, you must first set a function that tells Cloud Storage how to figure out how to get configuration settings. You do that with the CloudStorageAccount.SetConfigurationSettingPublisher(Action> configurationSettingPublisher) method. I knew that.
So I put it in my WebRole class, which inherits from RoleEntryPoint. That was fine. Code within my WebRole.OnStart method that used Table Storage was fine.
But when some of my other code, inside the web app, tried to access Table Storage, I got the exception saying I hadn’t called SetConfigurationSettingPublisher. It turns out that with Full IIS in Azure (which is the default if you create a project using the SDK version 1.3), the RoleEntryPoint runs in a different process (WaIISHost.exe, apparently) and my app runs under w3wp.exe.
And this exact problem is mentioned in that blog article, under the heading “Accessing Static Members from RoleEntryPoint and your web site”.
As annoying as this is, I’m kind of glad I figured out the problem (it all comes down to search keywords) in such a short amount of time!