2014-06-17 116 views
0

我收到以下錯誤:自定義配置節處理程序拋出異常

"An error occurred creating the configuration section handler for Config/Site1: 
Could not load file or assembly Operations or one of its dependencies. 
The system cannot find the file specified. (....vshost.exe.config line 9) 

任何一個可以幫助?

這是我的app.config文件,如果有幫助:

... 
<configSections> 
    <sectionGroup name="Config"> 
    <section name="Sites" type="System.Configuration.SingleTagSectionHandler" /> 
    <section name="Site1" type="Operations.Site1SectionHandler, Operations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" 
    allowLocation="true" 
    allowDefinition="Everywhere" /> 
    </sectionGroup> 
</configSections> 
... 
<Config> 
    <Sites Site1="mySite1" /> 
    <Site1 
    Property1="Value1" 
    /> 
</Config> 
... 

,這裏是我的聲明Site1SectionHandler(項目默認命名空間是行動):

Class Site1SectionHandler 
    Inherits ConfigurationSection 

    <ConfigurationProperty("Property1", IsRequired:=True)> _ 
    Public ReadOnly Property Property1 As String 
    Get 
     Return Me("Property1") 
    End Get 
    End Property 

End Class 

而且我這是怎麼叫它併發生以下情況:

Dim mySite1 = ConfigurationManager.GetSection("Config/Site1") 

不知道我是否缺少明顯的。 我最初嘗試沒有版本/文化/ ...等東西,但它沒有區別。

回答

0

道歉,如果我懷了人的時間,我的錯誤,所以你可以關閉這一個。我在谷歌搜索了一個答案,不記得它是什麼網站,但有些事情觸發我的想法,實現我的可執行的名稱,因此我的程序集名稱是不一樣的我的默認命名空間。因此,我改變:

<section name="Site1" type="Operations.Site1SectionHandler, Operations" /> 

<section name="Site1" type="Operations.Site1SectionHandler, OperationsProcessing" /> 

即我的exe文件的名字是OperationsProcessing.exe