473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

wmi to access the services runnig in PC ? -error help required

An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: The RPC server is unavailable.

See the code below and help me out to solve this problem.

public static void Main(string[] args)
{
string strvalue;
Console.WriteLine("Welcome to Ansync webservice application");
ManagementObject Status;
Status= new ManagementObject(null,new
ManagementPath("//server/root/cimv2:Win32_Service.Name='MSSQLServer'"),null);

Console.WriteLine(Status["Started"].ToString());
Status.Dispose();

Console.ReadLine();

}

I need to print started if SQLServer has started or stopped otherwise

Dec 23 '05 #1
2 1782
Care to point out WHICH line it occured on?

On top of that, are you getting this in your console application? Or
are you getting this in an ASP.NET web service? While your code is for a
console app, the first call to WriteLine is dubious.

If you are running this in ASP.NET, then by default, you are running
under the ASPNET account, which doesn't have access to the machine you are
trying to connect to, most likely.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"myclassmates" <je**********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: The RPC server is unavailable.

See the code below and help me out to solve this problem.

public static void Main(string[] args)
{
string strvalue;
Console.WriteLine("Welcome to Ansync webservice application");
ManagementObject Status;
Status= new ManagementObject(null,new
ManagementPath("//server/root/cimv2:Win32_Service.Name='MSSQLServer'"),null);

Console.WriteLine(Status["Started"].ToString());
Status.Dispose();

Console.ReadLine();

}

I need to print started if SQLServer has started or stopped otherwise

Dec 24 '05 #2

"myclassmates" <je**********@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: The RPC server is unavailable.

See the code below and help me out to solve this problem.

public static void Main(string[] args)
{
string strvalue;
Console.WriteLine("Welcome to Ansync webservice application");
ManagementObject Status;
Status= new ManagementObject(null,new
ManagementPath("//server/root/cimv2:Win32_Service.Name='MSSQLServer'"),null);

Console.WriteLine(Status["Started"].ToString());
Status.Dispose();

Console.ReadLine();

}

I need to print started if SQLServer has started or stopped otherwise


It's fundamental to read the docs before you start coding, your
managementpath is wrong!

("//server/root/cimv2:Win32_Service.Name....

should read:

(@"\\server\root\cimv2:Win32_Service.Name...

Note the @ the \\ and the \ !

Willy.
Dec 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
14
by: D | last post by:
Hey guys- not sure where this post fits in, so I cc'd a few other groups as well- hope you dont mind... I have someone creating a database for me in Access 2000 (or is it called XP?). When it's...
6
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
12
by: Paul H | last post by:
Say I have a Windows 2000 server running Terminal Services with a single file Access DB (not front end/back end) on it, could multiple users access the data base simultaneously? Paul
8
by: Rashmi | last post by:
Hi! I am new to web services. AFAIK, the advantages of using web services are : interoperable, easy integration and reuse, text based protocols and data formats - SOAP,WSDL,XML. Also, I read...
0
by: Alexander | last post by:
Haw can i get name of *.msi (runnig setup file) in installer class?
1
by: Bob Alston | last post by:
Anyone know of any features of the new Access 2007 that will improve on the ability of Access to work in a web environment??? Bob
9
by: JT | last post by:
Here is the overall structure I will be referring to: End-program ProvideWorkFlow.dll Forms and methods that properly manipulate calls to methods in AccessUtils AccessUtils (a web service)...
0
by: ary | last post by:
hi ,all. I have a virus scan , i found a way to scan a file with this application and it return a value for may program. using exit code . I can worked with this in debug mode but i in...
13
by: evancater | last post by:
My client wants to make their Access 2007 database available to offices around the country with multi-user permissions set to control access to the tables and forms, etc. The easiest thing would be...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.