0

SQLサーバーに接続しようとすると、winformでこのエラーが発生し、理由がわかりません。エラーは次のとおりです。構成システムの初期化に失敗しました。

これが私のコードです:

        connectionString = ConfigurationManager.ConnectionStrings("Connect5").ConnectionString

        Dim myConnection As New SqlConnection(connectionString)
        myConnection.Open()

ここに私のapp.configがあります:

 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
 <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="TestConsoleApp.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<system.diagnostics>
<sources>
<source name="DefaultSource" switchName="DefaultSwitch">
            <listeners>
                <add name="FileLog"/>
                <!-- Uncomment the below section to write to the Application Event Log -->
                <!--<add name="EventLog"/>-->
            </listeners>
        </source>
    </sources>
    <switches>
        <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
        <add name="FileLog"
             type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
             initializeData="FileLogWriter"/>
        <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
        <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->

    </sharedListeners>
</system.diagnostics>
<connectionStrings>
<add name="Connect5" connectionString="Data Source=asapinc.local\SQLEXPRESSSERVER;Initial Catalog=ASAP_DATABASE; User ID=ASAP;Password=CLEAN1"/>

4

2 に答える 2

0

壊れた設定ファイルのように聞こえます..

http://social.msdn.microsoft.com/Forums/vstudio/en-US/41cfc8e2-c7f4-462d-9a43-e751500deb0a/configuration-system-failed-to-initialize-help-please

于 2013-07-05T14:53:43.467 に答える
0

xmlこの行の単語に赤い下線が表示されるはずです

 <?xml version="1.0" encoding="utf-8" ?>

予期しない XML 宣言です。XML 宣言はドキュメントの最初のノードである必要があり、その前に空白文字を使用することはできません

于 2013-07-05T15:27:14.810 に答える