tags:

views:

17

answers:

1

Hello everyone,

I'm trying to make a webservice (WCF) to get information about my server. I made a class for WMI who can retreive information about cpu, ram, disks, etc...

Under visual studio, the service works fine, but when I deploy the service on IIS, I get all the information ... Except one ! I have one hard disk with two partition (C & D), when I deploy to IIS, there is an error when I try to retreive the "Size" of the second partition. The code works fine with a console application. I tried also with a simple ASP.Net website instead of WCF, doesn't work either.

Here is the code I use :

    ConnectionOptions aCO { get; set; }
    ManagementScope aMS { get; set; }

    public Wmi()
    {
        aCO = new ConnectionOptions();
        aMS = new ManagementScope("\\\\localhost", aCO);
    }
    .....
    ObjectQuery aQ = new ObjectQuery("select Name,Size,FreeSpace from Win32_LogicalDisk where DriveType=3");
    .....
    foreach (ManagementObject oReturn in aRToSet)
        {
                string letter = oReturn["Name"].ToString();
                long size = long.Parse(oReturn["Size"].ToString());
        }

I made some tests, the service works on my computer (windows 7 with IIS 7.5) but not on my server (Windows Server 2008).

Could someone give me any clue ?

Thanks.

A: 

I found what was wrong :

This was a security issue, the only user who can have access to the second disk (D:) was the super admin. I just add Administrator and User groups permissions, now I can get the infos !

Tom741