app.config 小插曲
在 "Windows Workflow Foundation 新一代工作流程開發實務" 中,6.2 的範例 MyWSExerciseSolution (P206) 中,app.config 有一個小小的插曲:
<configSections> 一定要放在 <configuration> 的第一個位置,如果像原先一樣把 <connectionStrings> 放在第一個,就會產生以下的錯誤訊息 ##CONTINUE##
<configSections> 一定要放在 <configuration> 的第一個位置,如果像原先一樣把 <connectionStrings> 放在第一個,就會產生以下的錯誤訊息 ##CONTINUE##
<?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="WSExercise.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <applicationSettings> <WSExercise.Properties.Settings> <setting name="WSExercise_ProductService_Service1" serializeAs="String"> <value>http://localhost/QuantityWS/ProductService.asmx</value> </setting> </WSExercise.Properties.Settings> </applicationSettings> <connectionStrings> <add name="WFNote" connectionString="data source=.;initial catalog=wfnote;integrated security=sspi"/> </connectionStrings> </configuration>
System.TypeInitializationException 未處理
Message="'System.Workflow.Runtime.WorkflowTrace' 的型別初始設定式發生例外狀況。"
Source="System.Workflow.Runtime"
TypeName="System.Workflow.Runtime.WorkflowTrace"
StackTrace:
於 System.Workflow.Runtime.WorkflowRuntime.PrivateInitialize(WorkflowRuntimeSection settings)
於 System.Workflow.Runtime.WorkflowRuntime..ctor()
於 WSExercise.Program.Main(String[] args) 於 D:\VC++.Net\Workflow\MyWSExerciseSolution\WSExercise\Program.cs: 行 19
InnerException: System.Configuration.ConfigurationErrorsException
Message="組態系統無法初始化"
Source="System.Configuration"
BareMessage="組態系統無法初始化"
Line=0
StackTrace:
於 System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
於 System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
於 System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
於 System.Configuration.ConfigurationManager.GetSection(String sectionName)
於 System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
於 System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
於 System.Diagnostics.DiagnosticsConfiguration.Initialize()
於 System.Diagnostics.DiagnosticsConfiguration.get_Sources()
於 System.Diagnostics.TraceSource.Initialize()
於 System.Diagnostics.TraceSource.set_Switch(SourceSwitch value)
於 System.Workflow.Runtime.WorkflowTrace..cctor()
InnerException: System.Configuration.ConfigurationErrorsException
Message="每個組態檔只允許一個 <configSections> 項目,而且 (如果有) 它必須是根 <configuration> 項目的第一個子系。 (D:\\VC++.Net\\Workflow\\MyWSExerciseSolution\\WSExercise\\bin\\Debug\\WSExercise.exe.Config line 6)"
Source="System.Configuration"
BareMessage="每個組態檔只允許一個 <configSections> 項目,而且 (如果有) 它必須是根 <configuration> 項目的第一個子系。"
Filename="D:\\VC++.Net\\Workflow\\MyWSExerciseSolution\\WSExercise\\bin\\Debug\\WSExercise.exe.Config"
Line=6
StackTrace:
於 System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
於 System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
於 System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
於 System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
InnerException:
留言