Re: ManagementEventWatcher.start=OutOfMemoryException

From: Manfred Braun (aa_at_bb.cc)
Date: 04/12/04


Date: Mon, 12 Apr 2004 23:09:19 +0200

Hi All again,

I forget to mention, that WBEMTEST give sthe same error-message !!!!!!!!

Regards,
Manfred

"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!)
> > >> >
> > >> >
> > >> >
> > >>
> > >>
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: ManagementEventWatcher.start=OutOfMemoryException
    ... maybe you should try to set logmode verbose to get more log details. ... I have to specify different user/pass for each machine to ... > connect to, but this is an exception, my most machines are domain-members. ... >> In your original post you said none of the machines are domain members, ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Probelm with Process and shortcut
    ... works with Process method. ... just first time is slow in ... my case because of the exception throwing. ... > |> Regards. ...
    (microsoft.public.dotnet.framework)
  • Re: ASP.NET Images are not displayed
    ... Richard Hein ... >>and img tag. ... > Would you please tell me how do you specify the picture's location in your ... > Best regards, ...
    (microsoft.public.vsnet.ide)
  • Re: Video hangs while its running under Windows CE
    ... S. Pradeep Kumar ... exception when you are running a DEBUG OS with that debugger. ... Exception in device.exe, gwes.exe & filesys.exe. ...
    (microsoft.public.windowsce.embedded)
  • Re: Starting default mail program
    ... mapi32.dll is usually installed with Outlook with MS Office or Microsoft ... Exchange tools. ... Catch ex As Exception ...
    (microsoft.public.dotnet.languages.vb)