I have upgraded to a new server and my console application tries to create a virtual directory in IIS 8.5 (Windows Server 2012).
I am getting this error:
[System.Runtime.InteropServices.COMException] {"Access is denied.\r\n"} System.Runtime.InteropServices.COMException ErrorCode 0x80070005
Access is denied.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_IsContainer() at System.DirectoryServices.DirectoryEntries.CheckIsContainer() at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)
I tried giving all permissions but still it is giving error as per this: Getting access denied while trying to create iis application from code
This Solution worked for me ==>
I also have to do this to resolve Access denied error ==> Run all Administrator in admin approval mode ==> Disabled ..