Search code examples
c#servicevmwarewindows-server-2012

Local fixed disk cannot be accessed from service


I'm experiencing the following strange behaviour:

A C# service fails to do any operations on local disk D: (e.g. check if a directory exists), while the console version wrapping the same assembly, has no problem whatsoever. Both are running under the same user account, which is member of the local Administrators group. When loggon on interactively, this same user also has no problems accessing drive D:\ using Windows explorer.

Inserting the following diagnostic code:

        DriveInfo[] drives = DriveInfo.GetDrives();
        foreach (DriveInfo drive in drives)
        {
            string label = drive.IsReady ? String.Format(" - {0}", drive.VolumeLabel) : " - drive not ready";
            string driveMessage = string.Format("Drive {0} - {1}{2}", drive.Name, drive.DriveType, label);
            EventLog.WriteEntry("NxG SiteService", driveMessage, EventLogEntryType.Information);
        }

shows that drive D: is a fixed disk, which is "not ready"?

Can someone please explain me why a fixed disk can be "not ready" when accessed from a service?

The environment is: Windows 2012 Server, running on a VMWare ESXi host v. 5.5.0


Solution

  • We found the cause & solution: http://social.technet.microsoft.com/Forums/windowsserver/en-US/179c72b2-2957-43a0-8798-472e907a6e55/access-denied-issue-with-server-2012-only-on-secondary-drive-not-c