2009-05-21 67 views
2

非難一下我們的頭靠在牆上這裏奇怪的例外出來OdbcConnection.Open的()

我們是一個獨立軟件開發商和有數以百計的使用我們的軟件沒有問題的公司。該軟件是.NET 2.0上的Winforms/C#。

我們的客戶之一安裝了我們的軟件,它在所有機器上啓動時崩潰,除了在一個人的筆記本電腦上工作正常。

在調用OdbcConnection.Open(),我們可以得到以下異常:

The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception. 
    at System.Transactions.Diagnostics.DiagnosticTrace.get_Verbose() 
    at System.Transactions.Transaction.get_Current() 
    at System.Data.Common.ADP.IsSysTxEqualSysEsTransaction() 
    at System.Data.Common.ADP.NeedManualEnlistment() 
    at System.Data.Odbc.OdbcConnection.Open() 
    at OurCompany.OurForm.connectionTestWorker_DoWork(Object sender) 

這有一個的InnerException:

Configuration system failed to initialize 
    at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) 
    at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName) 
    at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) 
    at System.Configuration.ConfigurationManager.GetSection(String sectionName) 
    at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName) 
    at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection() 

谷歌只是說:「是的app.config語法不正確,重建它「但同樣的app.config在數百臺其他機器上工作正常。

這裏的app.config,根據要求:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <configSections> 
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
     <section name="OurApp.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </sectionGroup> 
    </configSections> 
    <system.diagnostics> 
    </system.diagnostics> 
    <applicationSettings> 
    <OurApp.Properties.Settings> 
     <setting name="OurApp_WebServices_OurServiceName" serializeAs="String"> 
     <value>http://ourdomain.com/OurService.asmx</value> 
     </setting> 
    </OurApp.Properties.Settings> 
    </applicationSettings> 
    <appSettings> 
    <add key="WorkflowEngine" value="old" /> 
    <add key="ProductID" value="3" /> 
    <add key="EnableMigrationWizard" value="false" /> 
    <add key="UseAlternativeFtpPort" value="true" /> 
    <add key="FeedbackWhileConnecting" value="true" /> 
    </appSettings> 
</configuration> 

.NET Framework中的修復並沒有固定的這一點。我處於全面虧損狀態。有任何想法嗎?

+1

你能否提供配置文件以供審查? – 2009-05-21 15:55:03

回答

0

解決這個問題的方法是在同一SP /修補程序級別上使用來自另一臺計算機的已知工作副本覆蓋machine.config。

3

檢查machine.config和user.config。與app.config一起,這些是3 that make up the config sections

反射顯示EnsureInit有2條例外路徑:

catch (Exception exception) { 
    this._initError = new ConfigurationErrorsException(SR.GetString("Config_client_config_init_error"), exception); 
    throw this._initError; 
} catch { 
    this._initError = new ConfigurationErrorsException(SR.GetString("Config_client_config_init_error")); 
    throw this._initError; 
} 

由於第二隻處理non-CLS exception,我猜你打的第一個。如果是這樣的話,你可能需要遞歸地通過InnerException來獲得完整的細節。

+0

有趣的是,在此期間,我們的支持人員徹底刪除並重新安裝了.NET,並且該應用程序已開始工作。也許是刪除了machine.config並複製到一個新的。從邏輯上講,如果某些自動化過程在其機器上覆蓋machine.config,而.NET正在採用例外情況(無雙關語意圖),那麼我們的應用程序將會在以後的某個時刻再次停止工作正在擊中。時間會告訴我... – tomfanning 2009-05-21 16:24:05

+0

哦,我已經烘焙了另一個可以抓住InnerException的下一級別的構建,如果可以的話,我們將會看到早上他們的另一臺機器會帶來什麼... – tomfanning 2009-05-21 16:24:53

0

只是對於任何人的未來的參考,我有一個本地應用程序,我在我的桌面上開發的這個問題,並發現問題只是我有錯了。一旦這個問題得到解決,它就像一個魅力一樣。

0

我試圖用ASP/VB.NET 3.5 SP1打開OLE DB連接時發生了完全相同的錯誤。如果我將我的URL添加到IE中的可信站點列表中,則錯誤消失並且連接成功打開。我不知道這是否會解決其他瀏覽器中的問題。