none
WCF AppDomainInfo through WMI RRS feed

  • Question

  • I feel like I'm missing something here and there doesn't appear to be much documentation around it. Based on this (http://msdn.microsoft.com/en-us/library/vstudio/aa702681(v=vs.100).aspx) I should be able to access the MessageLogging's <system.ServiceModel><diagnostics><messageLogging> element at runtime using WMI. 

    I know that the System.Management namespace has been marked for deprecation for the new (MI) functionality, but this is for a 4.0 app so MI doesn't apply, but for the life of me I'm not getting the any ManagementObjects for the AppDomainInfo management path.  It seams rather odd to me that WMI would be used for a WCF service that is hosted in IIS which is an upon request type item (i.e. It's not like a SQL Service that's always running in the background).  Could this functionality only be intended for WCF hosted in WAS?  Am I missing something stupid simple?

    I've tried ObjectQuery/ManagementObjectSearcher as well, no luck.  I'm able to user the Connect() calls without any problems, but for some reason I don't get any results back.  Any suggestions?

    ConnectionOptions connOptions = new ConnectionOptions();

    connOptions.Authentication = AuthenticationLevel.PacketPrivacy;

    ObjectGetOptions getOptions = new ObjectGetOptions();

    getOptions.Timeout = new System.TimeSpan(0, 0, 30);

    ManagementScope scope = new ManagementScope(@"\\.\root\ServiceModel", connOptions);

    ManagementPath path = new ManagementPath("appdomaininfo");

    ManagementClass serverClass = new ManagementClass(scope, path, getOptions);

    serverClass.Get();

    instances = serverClass.GetInstances();

     
    Wednesday, October 29, 2014 8:55 PM

All replies

  • Hi Christopher Hurst,

    First please try to make sure that you have used the following config file:

    <diagnostics wmiProviderEnabled="true" performanceCounters="All">
       <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
        logMessagesAtTransportLevel="true" />
    </diagnostics>

    Then please also try to check the following articles:

    #Using Windows Management Instrumentation for Diagnostics:
    http://msdn.microsoft.com/en-us/library/ms735120.aspx .

    #WMI Provider:
    http://msdn.microsoft.com/en-us/library/ms751442.aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 30, 2014 3:11 AM
    Moderator
  • Hi Amy

    Yes, I've already got the <diagnostics> element in my app config file with WMI turned on.  I've got the log attributes currently set to false as this is the default I want for the application.  I'm attempting to access this section of the app.config using WMI in order to *update* the log attributes at runtime based on user input to enable specific parts of logging. 

    I was looking at the first link before posting and glanced over the powershell script to grant access .  Could it be that I'm missing the permissions to access the WMI functionality?  As I'm debugging in Visual Studio using the build the ASP.NET webhost, would the Build-In Users group be enough or is there a different account/group that should be used instead.

    If what I'm missing is the WMI Registration Permissions, then I don't believe this is the path I want to take as I don't want to open that up on a XBAP app for all users.

    Thursday, October 30, 2014 3:45 PM
  • Bump
    Wednesday, November 5, 2014 10:06 PM
  • You had to add aspnet user to ServiceModel security in WMI control as aspnet_wp process runs under aspnet user. With this i was able to access the WMI data in WMI object browser.
    • Proposed as answer by gferyt gfdh Thursday, November 6, 2014 10:19 AM
    Thursday, November 6, 2014 10:18 AM