New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CloudConfigurationManager throws exception if not run in azure dev emulator #91
Comments
Thank you for reporting this issue - we are investigating the right fix for this issue. |
Hi When I use the Web Project as Startup and then call: I get: System.Configuration.ConfigurationErrorsException was unhandled by user code |
In the current project I solved this like this:
Also you can use RoleEnvironment.IsAvailable to check if you are running inside azure or not and act accordingly (use web.config vs. cloud configuration). Note that I'm not using CloudConfigurationManager class but the old RoleEnvironment.GetConfigurationSettingValue() to read the settings. Edit: I'm actually initializing azure trace listener in WebRole.cs and not in global.asax.cs. |
I have done the steps recommended by @tparvi above, and this seems to get me a little farther along...sometimes. I occasionally still get a message when I hit F5 that says it could not attach the debugger to one of my web roles. To make this go away, tipically, I have to close VS2012, and exit out of the emulator. Then re-open VS2012 and my solution, then F5 again. After the changes above and when the emulator actually attaches the debugger, I do get the web app to come up in the browser, but when it hits a line of code that calls CloudConfigurationManager.GetSetting(key), it throws a configuration exception with an inner exception stating that I am not running in a cloud. Also, if I try to hit a line that calls CloudStorageAccount.FromConfigurationSetting(string), this call always returns null, although the connection string is pointing to a valid account key. It's also worth pointing out that I have 3 team members that use the same source code pulled down from our SVN repository, and they are able to successfully build, run the emulator, and run the apps with the same config settings. One of those coworkers (like me) is running VS 2012, while the other two are still on VS2010. Please help! This issue is killing my productivity. |
Is there any headway on this? My project (for no reason) just started to throw this error regardless of configuration. I am know completely blocked from using cloudstorage from localhost. |
Same problem. Any solution? |
So, um, hey Microsoft, you gonna fix this or what? It's still an issue in v2.1 and this has been a known issue for over a year now. Very annoying. VS2012 RTM on a WebRole, have to comment out or delete DiagnosticMonitorTraceListener from webconfig in order to run the app outside of the emulator, even though this is the whole point of CloudConfigurationManager. |
I'm following up with folks on this. |
Hi guys, |
what release will this fix ship in? |
@ogazitt we're working to prepare an increment nuget update with the hotfix; will reopen this and assign to you to verify once we get that out, hopefully in the next week or so. |
Thanks Jeff. Having a hot fix would be very helpful given that building it by hand would require me to change the strong naming references throughout the project. FWIW, with the 2.1 SDK, I've never been able to work around this issue by adding the DiagnosticMonitorTraceListener instance to the Trace.Listeners collection. Right now I have to remember to uncomment the appropriate config directive before I deploy, which is obviously suboptimal. Looking forward to a real fix :) — On Tue, Oct 22, 2013 at 10:32 PM, Jeff Wilcox notifications@github.com
|
@ogail If you would like to at least eliminate the manual step of changing your config before deploying, you can use a separate solution configuration for deploying. |
@MFisherMSFT I know how to create separate .cscfg for production and local but I don't know how to create separate web.config files without some post-build hackery. In the past I know there was a mechanism in asp.net to have debug and release transforms for the web.config file, but in VS2012 / Azure SDK 2.1 that doesn't seem to be part of the default azure webrole project. I was about to write a startup task when I found this thread :-) Having a real fix will save me from doing that. |
@ogazitt The mechanism that performs transforms of web.config based on the solution configuration still exists. When I create a new Windows Azure Cloud Service project with a Web Role, I see Web.Debug.config and Web.Release.config files under Web.config (which needs to be expanded in the Solution Explorer). And you can right-click on Web.config to create new config transform files. |
@MFisherMSFT wow, I can’t believe I missed the arrow to expand the web.config node in solution explorer. Embarrassing :-) Thanks for the pointer! |
Hi all, Cheers, |
I tried this out by installing the newest (v2.0.2) Windows Azure Configuration Manager package off NuGet. Oddly enough, while my issues running the web project in IIS Express have gone away, I seem to have a new issue with neither the webrole nor the worker role in my azure project logging data anymore. My setup looks as follows: web.config for webrole, app.config for worker role have the same sys.diagnostics section:
And the RoleEntryPoint.OnStart() override for both roles has the following code:
Microsoft.WindowsAzure.Diagnostics.LogLevel.Information; My WADLogsTable hasn't received any of my Trace.WriteLine() messages since I've redeployed. I even flushed the wad-control-container blobs (as has been noted on stackoverflow and other places), to no avail. Unfortunately I'm not 100% sure that the broken traces is correlated to the new Microsoft.WindowsAzure.Configuration.dll, but I'm starting to run out of ideas. Update: I can confirm that I no longer get Azure exceptions when I run the web project in IIS Express. Thanks! |
Latest hydra specs with configurable resource namespace param into
* Make app settings and conn strings lazy * Fix tests and re-record * Fix function app kind * Re-record CDN and TM * Address feedback
I'm using VS2012 RC with Azure SDK v1.7. I created new cloud service using ASP.NET MVC4 (empty application) and put following code into Application_Start (the setting is configured in web.config and service configuration correctly):
If I set my web application as startup project in VS the line throws exception "Not running in a hosted service or the Development Fabric" This happens when AzureApplicationSettings calls Trace.WriteLine.
So the problem is that by default the Azure DiagnosticMonitorTraceListener is registered in the web.config and if you are not running inside dev emulator all Trace messages fail.
I'm reporting this because I thought the whole point of CloudConfigurationManager was to make it easier to run web application either inside or outside of the azure dev emulator. Simple fix is to replace the azure trace listener from web.config with something that works without azure dev emulator. So maybe this can be fixed with documentation updated on MSDN (couldn't find anything related to this issue) or is there a better way to handle this?
The text was updated successfully, but these errors were encountered: