Re: ManagementEventWatcher.start=OutOfMemoryException
From: Willy Denoyette [MVP] (willy.denoyette_at_pandora.be)
Date: 04/12/04
- Previous message: Manfred Braun: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- In reply to: Manfred Braun: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Next in thread: Ryan Ackerman: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Reply: Ryan Ackerman: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Reply: Manfred Braun: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Apr 2004 23:19:27 +0200
Did you inspect the wbem logfiles? (%sysdir%\system32\wbem\logs\xxxx.log),
maybe you should try to set logmode verbose to get more log details.
Willy.
"Manfred Braun" <aa@bb.cc> wrote in message
news:eJU9fENIEHA.2128@TK2MSFTNGP11.phx.gbl...
> Hello Willy and All,
>
> in the meantime, I grabbed out an old script, which does similar the same
> and astoundingly, it produces the same error. The exact output from the
> catch in C# is:
>
> Exception:System.OutOfMemoryException: Not enough storage is available to
> complete this operation.
> at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32
> errorCode, IntPtr errorInfo)
> at System.Management.ManagementEventWatcher.Start()
> at EventlogTestWatcher.Run() in
> d:\Develop\Dev\Experimente\cs\Projetcs\EventlogCollectorService\Tools\Eventl
> ogTestWat
> cher1.cs:line 88
>
> [Sorry, this is a more full blown version, but pricipially the same;But so
> the line-number is naturally another on].
> And I cannot imagine, what type of storage could be meant, disk and memory
> are all enough present.
>
>
> About the "authority": This is how [if ;-) ] I understand WMI. In this
> case
> the authority is the remote machine itself, where the given user must
> exist
> and has that password. BTW, not to mention, the accounts all have admin
> rights there. I have to specify different user/pass for each machine to
> connect to, but this is an exception, my most machines are domain-members.
> If I am back into work tomorrow, I'll test a W2k-W2K query using a
> domain-account having admin rights on both sides - but this is not my
> requested need :-(
> The code works the same, if I omit the "Authority" and specify the
> "computer\user" syntax for the username.
>
>
> I just added
>
> co.Impersonation = ImpersonationLevel.Impersonate;
> co.Authentication = AuthenticationLevel.Connect;
>
> to the code, but the error remains the same.
> I remember, that there were changes to the default DCOM security settings
> between different OS versions, but I do not exactly remember, which
> difference. I have had a look at all my testmachines with DCOMCNFG and the
> settings are all the same, for NT4/W2K/XP [connect/identify].
>
> Thanks for your help so far!!!
> Best regards,
> Manfred
>
> "Willy Denoyette [MVP]" <willy.denoyette@pandora.be> wrote in message
> news:%23XdymmMIEHA.3848@tk2msftngp13.phx.gbl...
>> Can't try it out right now, but here are some hints...
>> Did you try to set ImpersonationLevel.Impersonate, this is the default on
>> W2K and higher but not on NT4.
>> Did you try using wbemtest.exe to diagnose the problems source?
>> In your original post you said none of the machines are domain members,
> why
>> did you specify the Authority?
>> Can you put your Start method in a try/catch block to make sure the
>> exception is thrown by Start.
>>
>> Willy.
>>
>> "Manfred Braun" <aa@bb.cc> wrote in message
>> news:eYVanzLIEHA.3040@TK2MSFTNGP09.phx.gbl...
>> > Hi Willy and All,
>> >
>> > ok, I striped the code down to a functional minimum, here it is:
>> >
>> >
>> > //ProbDemoTest.cs
>> >
>> > using System;
>> > using System.Management;
>> >
>> > public class ProbDemo
>> > {
>> > public static void Main()
>> > {
>> > ManagementEventWatcher watcher;
>> > ConnectionOptions co;
>> > ManagementPath mp;
>> > ManagementScope ms;
>> > WqlEventQuery weq;
>> >
>> > co = new ConnectionOptions();
>> > co.Timeout = new TimeSpan(0, 0, 60);
>> > co.EnablePrivileges = true;
>> > co.Authority = "NTLMDOMAIN:x100";
>> > co.Username = "tester";
>> > co.Password = "abc";
>> >
>> > mp = new ManagementPath();
>> > mp.NamespacePath = @"\root\cimv2";
>> > mp.Server = "x100";
>> > ms = new ManagementScope(mp, co);
>> > weq = new WqlEventQuery("select * from __InstanceCreationEvent where
>> > TargetInstance isa 'Win32_NTLogEvent'");
>> > watcher = new ManagementEventWatcher(ms, weq);
>> > watcher.EventArrived += new
> EventArrivedEventHandler(ProbDemo.OnMessage);
>> > watcher.Start(); //ERROR
>> >
>> > Console.WriteLine("Press enter to finish querying...");
>> > Console.ReadLine();
>> > }
>> >
>> > public static void OnMessage(object sender, EventArrivedEventArgs e)
>> > {
>> > Console.WriteLine("Event, event...");
>> > ManagementBaseObject mbo =
>> > (ManagementBaseObject)e.NewEvent["TargetInstance"];
>> > string msg = ((string) mbo["Message"]).Trim();
>> > Console.WriteLine(msg);
>> > }
>> >
>> > }
>> >
>> >
>> > Luckily [???], this small version has the same error-behavior ....
>> >
>> > Thanks so far and
>> > best regards,
>> > Manfred
>> >
>> >
>> > "Willy Denoyette [MVP]" <willy.denoyette@pandora.be> wrote in message
>> > news:Owi%23QYKIEHA.1048@TK2MSFTNGP12.phx.gbl...
>> >> Please post a complete sample that illustrates the problem, whithout
> any
>> >> code it's hard to tell what's the cause of such an exception.
>> >>
>> >> Willy.
>> >>
>> >> "Manfred Braun" <aa@bb.cc> wrote in message
>> >> news:%23ta73rJIEHA.1220@tk2msftngp13.phx.gbl...
>> >> > Hi All,
>> >> >
>> >> > I am writing on a small tool in C#, which creates a
>> > ManagementEventWatcher
>> >> > to receives events from a remote machine. Astoundingly, this behaves
>> >> > different between different OS. It works fine, if the exe runs on
>> > Windows
>> >> > 2000 and connects to NT4 or XP, but it cannot connect to other
> Windows
>> >> > 2000
>> >> > machines. If the exe runs on XP, it can connect to Windows 2000 and
>> >> > othe
>> >> > machines as well.
>> >> >
>> >> > I get the error in the subject line, with text "Not enough storage
>> >> > is
>> >> > available to complete this operation."
>> >> >
>> >> > All effected boxes have about 200 MB free memory [and not sure, that
>> >> > "sorage", form the error-message, means memory] ;-) and I am sure,
>> >> > it's
>> > a
>> >> > securiry issue. I compared the DCOM settings and they are the same
> for
>> > all
>> >> > tested computers [again, which are NT4, XP and Windows 2000]. None
>> >> > of
>> > this
>> >> > test-machines is member of any domain and I specify explicitely
>> >> > username
>> >> > and
>> >> > password, which are valid on the remote computer and work fine for
>> >> > other
>> >> > methods [DirectoryEntry, specifying credentials and this works!!!!!,
>> > even
>> >> > for Windows 2000!!!].
>> >> >
>> >> > I made some tests to vary my connection-settings for the Windows
>> >> > 2000
>> >> > machine and also tried to explicitely set ImpersonationLevel and
>> >> > Authentication in code, without any success.
>> >> >
>> >> > Any help would be really very welcomed, I am out of hope!
>> >> >
>> >> > Best regards,
>> >> > Manfred Braun
>> >> >
>> >> > (Private)
>> >> > Mannheim
>> >> > Germany
>> >> >
>> >> > mailto:_manfred.braun_@manfbraun.de
>> >> > (Remove the anti-spam-underscore to mail me!)
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
- Previous message: Manfred Braun: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- In reply to: Manfred Braun: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Next in thread: Ryan Ackerman: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Reply: Ryan Ackerman: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Reply: Manfred Braun: "Re: ManagementEventWatcher.start=OutOfMemoryException"
- Messages sorted by: [ date ] [ thread ]