我有一個自定義的截面的dot.NET 4.0 web應用程序定義:錯誤創建配置節處理程序
<configuration>
<configSections>
<section name="registrations" type="System.Configuration.IgnoreSectionHandler, System.Configuration, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="true" restartOnExternalChanges="true" allowLocation="true"/>
....
在web.config文件我有相應的部分的端部:
....
<registrations>
.....
</registrations>
</configuration>
每次我打電話System.Configuration.ConfigurationManager.GetSection("registrations");
我得到以下異常:
出錯創建CON用於註冊的配置節處理程序:給定的程序集名稱或代碼庫無效。 (例外從HRESULT:0x80131047)(C:\ ... \ web.config行13)
我也使用Unity,但不知道是否以任何方式與錯誤相關。
你以前遇到過這個錯誤嗎?我該如何解決它?我需要用其他東西替換IgnoreSectionHandler
嗎?
我剛剛注意到了!廢話...修正它,現在我有'System.Configuration.IgnoreSectionHandler,系統,版本= 2.0.0.0,文化=中立,PublicKeyToken = b77a5c561934e089'。我沒有收到任何錯誤,但該部分以「null」形式返回。任何想法如何獲得部分內容? – JohnDoDo 2013-04-29 18:19:51
更新了答案 – 2013-04-29 18:26:15
終於明白null是從哪裏來的。我一直愚蠢的一次通過混亂的類型值,他們愚蠢的第二次不明白爲什麼我得到一個null。那麼,這是一個IgnoreSectionHandler,它的Create方法返回null。衛生署! – JohnDoDo 2013-04-30 07:49:26