-2
我有一個獨立的VS2015應用程序在批處理作業中運行。在開發服務器上運行並且未在測試服務器上運行的Visual Studio 2015應用程序
xxx.bat作業調用生成輸出的xxx.exe。
我已經測試了完全正常運行的本地計算機和開發服務器上的完整解決方案。但是,部署到測試服務器的相同代碼崩潰,說RptBat.Console停止工作與'CLR203r'錯誤System.Configuration。
該應用程序不輸入任何日誌信息供我排除故障。 我試圖更新xxx.cmd.exe.config文件,但它沒有幫助。
請指教!
堆棧跟蹤對於appsettings文件來說真的很大,但是對於該文件來說一切似乎都沒問題。
C:\rptbat>call C:\rptbat\rptbat.cmd.exe -v P
log4net:ERROR DefaultRepositorySelector: Exception while reading ConfigurationSe
ttings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed t
o initialize ---> System.Configuration.ConfigurationErrorsException: The 'config
uration' start tag on line 2 does not match the end tag of 'appSettings'. Line 2
6, position 5. (C:\rptbat\rptbat.Cmd.exe.config line 26) ---> System.Xml.XmlException: The 'configuration' start
tag on line 2 does not match the end tag of 'appSettings'. Line 26, position 5.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlTextReaderImpl.Skip()
at System.Xml.XmlTextReader.Skip()
at System.Configuration.XmlUtil.StrictSkipToNextElement(ExceptionAction actio
n)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil
xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, Ov
errideModeSetting overrideMode, Boolean skipInChildApps)
at System.Configuration.BaseConfigurationRecord.ScanSections(XmlUtil xmlUtil)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignor
eLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(Configurat
ionSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey
)
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sect
ionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
at System.Diagnostics.TraceInternal.InitializeSettings()
at System.Diagnostics.TraceInternal.WriteLine(String message)
at System.Diagnostics.Trace.WriteLine(String message)
at log4net.Util.LogLog.EmitErrorLine(String message)
log4net:ERROR DefaultRepositorySelector: Exception while reading ConfigurationSe
ttings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed t
o initialize ---> System.Configuration.ConfigurationErrorsException: The 'config
uration' start tag on line 2 does not match the end tag of 'appSettings'. Line 2
6, position 5. (C:\rptbat\ReportBatcher
.Cmd.exe.config line 26) ---> System.Xml.XmlException: The 'configuration' start
tag on line 2 does not match the end tag of 'appSettings'. Line 26, position 5.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlTextReaderImpl.Skip()
at System.Xml.XmlTextReader.Skip()
at System.Configuration.XmlUtil.StrictSkipToNextElement(ExceptionAction actio
n)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil
xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, Ov
errideModeSetting overrideMode, Boolean skipInChildApps)
at System.Configuration.BaseConfigurationRecord.ScanSections(XmlUtil xmlUtil)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignor
eLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(Configurat
ionSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey
)
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_AppSettings()
at log4net.Util.SystemInfo.GetAppSetting(String key)
log4net:ERROR DefaultRepositorySelector: Exception while reading ConfigurationSe
ttings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed t
o initialize ---> System.Configuration.ConfigurationErrorsException: The 'config
uration' start tag on line 2 does not match the end tag of 'appSettings'. Line 2
6, position 5. (C:\rptbat\ReportBatcher
.Cmd.exe.config line 26) ---> System.Xml.XmlException: The 'configuration' start
tag on line 2 does not match the end tag of 'appSettings'. Line 26, position 5.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlTextReaderImpl.Skip()
at System.Xml.XmlTextReader.Skip()
at System.Configuration.XmlUtil.StrictSkipToNextElement(ExceptionAction actio
n)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil
xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, Ov
errideModeSetting overrideMode, Boolean skipInChildApps)
at System.Configuration.BaseConfigurationRecord.ScanSections(XmlUtil xmlUtil)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignor
eLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(Configurat
ionSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey
)
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_AppSettings()
at log4net.Util.SystemInfo.GetAppSetting(String key)
log4net:ERROR DefaultRepositorySelector: Exception while reading ConfigurationSe
ttings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed t
o initialize ---> System.Configuration.ConfigurationErrorsException: The 'config
uration' start tag on line 2 does not match the end tag of 'appSettings'. Line 2
6, position 5. (C:\rptbat\ReportBatcher
.Cmd.exe.config line 26) ---> System.Xml.XmlException: The 'configuration' start
tag on line 2 does not match the end tag of 'appSettings'. Line 26, position 5.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlTextReaderImpl.Skip()
at System.Xml.XmlTextReader.Skip()
at System.Configuration.XmlUtil.StrictSkipToNextElement(ExceptionAction actio
n)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil
xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, Ov
errideModeSetting overrideMode, Boolean skipInChildApps)
at System.Configuration.BaseConfigurationRecord.ScanSections(XmlUtil xmlUtil)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignor
eLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(Configurat
ionSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey
)
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_AppSettings()
at log4net.Util.SystemInfo.GetAppSetting(String key)
log4net:ERROR DefaultRepositorySelector: Exception while reading ConfigurationSe
ttings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed t
o initialize ---> System.Configuration.ConfigurationErrorsException: The 'config
uration' start tag on line 2 does not match the end tag of 'appSettings'. Line 2
6, position 5. (C:\rptbat\ReportBatcher
.Cmd.exe.config line 26) ---> System.Xml.XmlException: The 'configuration' start
tag on line 2 does not match the end tag of 'appSettings'. Line 26, position 5.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlTextReaderImpl.Skip()
at System.Xml.XmlTextReader.Skip()
at System.Configuration.XmlUtil.StrictSkipToNextElement(ExceptionAction actio
n)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil
xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, Ov
errideModeSetting overrideMode, Boolean skipInChildApps)
at System.Configuration.BaseConfigurationRecord.ScanSections(XmlUtil xmlUtil)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignor
eLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(Configurat
ionSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey
)
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_AppSettings()
at log4net.Util.SystemInfo.GetAppSetting(String key)
log4net:ERROR XmlConfigurator: Error while loading XML configuration
System.Xml.XmlException: The 'configuration' start tag on line 2 does not match
the end tag of 'appSettings'. Line 26, position 5.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean prese
rveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at log4net.Config.XmlConfigurator.Configure(ILoggerRepository repository, Str
eam configStream)
log4net:ERROR DefaultRepositorySelector: Exception while reading ConfigurationSe
ttings. Check your .config file is well formed XML.
System.Configuration.ConfigurationErrorsException: Configuration system failed t
o initialize ---> System.Configuration.ConfigurationErrorsException: The 'config
uration' start tag on line 2 does not match the end tag of 'appSettings'. Line 2
6, position 5. (C:\rptbat\ReportBatcher
.Cmd.exe.config line 26) ---> System.Xml.XmlException: The 'configuration' start
tag on line 2 does not match the end tag of 'appSettings'. Line 26, position 5.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlTextReaderImpl.Skip()
at System.Xml.XmlTextReader.Skip()
at System.Configuration.XmlUtil.StrictSkipToNextElement(ExceptionAction actio
n)
at System.Configuration.BaseConfigurationRecord.ScanSectionsRecursive(XmlUtil
xmlUtil, String parentConfigKey, Boolean inLocation, String locationSubPath, Ov
errideModeSetting overrideMode, Boolean skipInChildApps)
at System.Configuration.BaseConfigurationRecord.ScanSections(XmlUtil xmlUtil)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignor
eLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(Configurat
ionSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey
)
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.PrepareConfigSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.get_AppSettings()
at log4net.Util.SystemInfo.GetAppSetting(String key)
首先,您是否確保將相同的.Net框架版本安裝在您的開發(本地)計算機上已安裝(並由構建的應用程序使用)的'test'環境服務器上?其次,如果您擁有它,請包含完整的堆棧跟蹤以及您可以從服務器收集的任何其他調試信息,以便發現問題。 – gmiley
[一些討論](https://social.msdn.microsoft.com/Forums/vstudio/en-US/a7ed93ad-2923-48c4-9e51-cf0bd6d4e100/net-framework-4-clr20r3-error?forum=netfxsetup)顯示,確實是.Net問題..也檢查你的'.config'不管它命名.. –
發佈你的stacktrace後,它看起來像你有一個格式不正確的配置文件。確保你的配置文件沒有損壞。你的錯誤表明你的'appSettings'沒有匹配的開始/結束標籤,或者該標籤之前的元素不正確。如果可能,請在你的問題中包含你的app.config文件。 – gmiley