Giter Club home page Giter Club logo

Comments (18)

piyushjo avatar piyushjo commented on May 12, 2024

Thank you for reporting this issue - we are investigating the right fix for this issue.

from azure-sdk-for-net.

tobese avatar tobese commented on May 12, 2024

Hi
I have a similar problem. Running VS2010 and using a WCF service in a WebRole.

When I use the Web Project as Startup and then call:
CloudConfigurationManager.GetSetting("SomeSetting");

I get:

System.Configuration.ConfigurationErrorsException was unhandled by user code
Message=Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
Source=System
BareMessage=Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
Line=0
StackTrace:
at System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData)
at System.Diagnostics.TypedElement.BaseGetRuntimeObject()
at System.Diagnostics.ListenerElement.GetRuntimeObject()
at System.Diagnostics.ListenerElementsCollection.GetRuntimeObject()
at System.Diagnostics.TraceInternal.get_Listeners()
at System.Diagnostics.TraceInternal.WriteLine(String message)
at System.Diagnostics.Trace.WriteLine(String message)
at Microsoft.WindowsAzure.AzureApplicationSettings..ctor()
at Microsoft.WindowsAzure.CloudConfigurationManager.get_AppSettings()
at Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting(String name)
at Ifs.Cloud.Production.ServerRole.Downlink.GetResource(String resource, Int32 pageSize, Int32 page, Call call) in E:\work\ZapZap\VisualStudio\TestProjects\ServerRole2\Ifs.Cloud.Production.ServerRole\Downlink.svc.cs:line 29
at SyncInvokeGetResource(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
InnerException: System.InvalidOperationException
Message=Not running in a hosted service or the Development Fabric.
Source=Microsoft.WindowsAzure.Diagnostics
StackTrace:
at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance()
at Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor()
InnerException:

from azure-sdk-for-net.

tparvi avatar tparvi commented on May 12, 2024

In the current project I solved this like this:

  1. Comment out the Azure diagnostics listener from web.config (system.diagnostics / trace / listeners where you see Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener)

  2. In the WebRole.cs configure the trace listener by hand:

    Trace.Listeners.Add(new DiagnosticMonitorTraceListener());

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.

from azure-sdk-for-net.

tafs7 avatar tafs7 commented on May 12, 2024

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.

from azure-sdk-for-net.

pr1ntr avatar pr1ntr commented on May 12, 2024

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.

from azure-sdk-for-net.

hmvs avatar hmvs commented on May 12, 2024

Same problem. Any solution?

from azure-sdk-for-net.

dapug avatar dapug commented on May 12, 2024

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.

from azure-sdk-for-net.

jeffwilcox avatar jeffwilcox commented on May 12, 2024

I'm following up with folks on this.

from azure-sdk-for-net.

ogail avatar ogail commented on May 12, 2024

Hi guys,
I've proposed a fix in a PR, we'd appreciate your feedback

from azure-sdk-for-net.

ogazitt avatar ogazitt commented on May 12, 2024

what release will this fix ship in?

from azure-sdk-for-net.

jeffwilcox avatar jeffwilcox commented on May 12, 2024

@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.

from azure-sdk-for-net.

ogazitt avatar ogazitt commented on May 12, 2024

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 :)


Sent from Mailbox for iPhone

On Tue, Oct 22, 2013 at 10:32 PM, Jeff Wilcox [email protected]
wrote:

Reopened #91.

Reply to this email directly or view it on GitHub:
#91

from azure-sdk-for-net.

MFisherMSFT avatar MFisherMSFT commented on May 12, 2024

@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.

from azure-sdk-for-net.

ogazitt avatar ogazitt commented on May 12, 2024

@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.

from azure-sdk-for-net.

MFisherMSFT avatar MFisherMSFT commented on May 12, 2024

@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.

from azure-sdk-for-net.

ogazitt avatar ogazitt commented on May 12, 2024

@MFisherMSFT wow, I can’t believe I missed the arrow to expand the web.config node in solution explorer. Embarrassing :-) Thanks for the pointer!

from azure-sdk-for-net.

ogail avatar ogail commented on May 12, 2024

Hi all,
We have pushed the fix for this issue in the version 2.0.2 on NuGet, would appreciate if you can give it a try and let us hear your feedback.

Cheers,
Ogail

from azure-sdk-for-net.

ogazitt avatar ogazitt commented on May 12, 2024

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:

        <system.diagnostics>
          <trace>
            <listeners>
              <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
                <filter type="" />
              </add>
            </listeners>
          </trace>
        </system.diagnostics>

And the RoleEntryPoint.OnStart() override for both roles has the following code:

                var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
                config.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1.0);
                config.Logs.BufferQuotaInMB = 1000;
                config.Logs.ScheduledTransferLogLevelFilter = Microsoft.WindowsAzure.Diagnostics.LogLevel.Verbose;

Microsoft.WindowsAzure.Diagnostics.LogLevel.Information;
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);

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:
Note sure how my deployment got horked but after deleting the production deployment and redeploying everything, my tracing issues seem to have gone away.

I can confirm that I no longer get Azure exceptions when I run the web project in IIS Express.

Thanks!

from azure-sdk-for-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.