我使用:WebConfigurationManager.OpenWebConfiguration拋出未能映射路徑「/」
Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
但不幸的是它拋出未能映射路徑「/」錯誤。 我也嘗試提供物理應用程序路徑,但它仍然不工作....
我使用:WebConfigurationManager.OpenWebConfiguration拋出未能映射路徑「/」
Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
但不幸的是它拋出未能映射路徑「/」錯誤。 我也嘗試提供物理應用程序路徑,但它仍然不工作....
我沒有看到任何問題,你在這裏的行。你可以嘗試做這種方式還有:
System.Configuration.Configuration objConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
如果失敗嘗試按照下面的步驟「啓用父路徑」從你的IIS:
該問題可以通過以管理員身份運行Visual Studio來解決。我在Windows 7系統上看到了這個錯誤,在一個系統上,相同的代碼工作得很好,但沒有在另一個系統上運行VS,因爲管理員爲我們解決了這個問題。
這是一個reference在同一個問題和相同的Vista解決方案。