2015-05-26 25 views
0

我已經升級到新服務器,並且我的控制檯應用程序嘗試在IIS 8.5(Windows 2012)中創建虛擬目錄。訪問被拒絕錯誤當我嘗試使用控制檯應用程序添加新虛擬目錄

我收到此錯誤:

[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)

我試圖讓所有的權限,但它畢竟是給錯誤按本:Getting access denied while trying to create iis application from code

+0

您是否嘗試以管理員身份運行它? – Uriil

+2

你可以發佈你的代碼嗎?擁有應用程序對IIS運行訪問權限的帳戶?你本地/遠程運行嗎?你是否使用提升模式(以管理員身份運行)? –

+0

嘿Uriil,是的,我已經授權它運行它作爲管理員,但仍然問題即將到來。 – CodeSync

回答

0

該解決方案爲我==>

http://blogs.msdn.com/b/jpsanders/archive/2009/05/13/iis-7-adsi-error-system-runtime-interopservices-comexception-0x80005000-unknown-error-0x80005000.aspx?CommentPosted=true#commentmessage ..

我也必須這樣做來解決訪問被拒絕的錯誤 ==>運行所有管理員在管理員審批模式==>禁用..

+0

讓我試試你提到的事情..在哪裏可以找到這個選項? – CodeSync

+0

打開本地安全策略,然後單擊安全選項並向下滾動,您會看到「在管理員批准模式下運行所有​​管理員」。 –

相關問題