特定文件夹名称上的ConfigurationErrorsException

时间:2018-09-05 12:29:31

标签: c# winforms configuration app-config

我在最终客户那里有一个正在运行的应用程序,效果很好 但由于某种原因,该应用程序停止运行 检查事件日志后,我发现该异常属于类型

System.Configuration.ConfigurationErrorsException

我在其他配置相同的计算机上进行了检查,该应用正常运行

这是堆栈跟踪

Application: CVFeedMgmt.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Configuration.ConfigurationErrorsException
Stack:
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(System.String, Boolean, Boolean, Boolean, Boolean, System.Object ByRef, System.Object ByRef)
   at System.Configuration.BaseConfigurationRecord.GetSection(System.String)
   at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String)
   at System.Configuration.ConfigurationManager.GetSection(System.String)
   at System.Configuration.ClientSettingsStore.ReadSettings(System.String, Boolean)
   at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(System.Configuration.SettingsContext, System.Configuration.SettingsPropertyCollection)
   at System.Configuration.SettingsBase.GetPropertiesFromProvider(System.Configuration.SettingsProvider)
   at System.Configuration.SettingsBase.GetPropertyValueByName(System.String)
   at System.Configuration.SettingsBase.get_Item(System.String)
   at System.Configuration.ApplicationSettingsBase.GetPropertyValue(System.String)
   at System.Configuration.ApplicationSettingsBase.get_Item(System.String)
   at CVFeedMgmt.Properties.Settings.get_CVSyncErrorLog()
   at CVFeedMgmt.Program.Main(System.String[])

这是 app.cofnig

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="CVFeedMgmt.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <connectionStrings>
        <add name="CVFeedMgmt.Properties.Settings.connectionString" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=True;Initial Catalog = CVfeedDB;&#xA;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False; Trusted_Connection=True; MultipleActiveResultSets=True;" />
    </connectionStrings>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <userSettings>
        <CVFeedMgmt.Properties.Settings>
            <setting name="DebugDataRoot" serializeAs="String">
                <value>http://192.168.66.32/CVFeedMgmt/CVFeedData.svc/</value>
            </setting>
            <setting name="DataRoot" serializeAs="String">
                <value>http://52.70.77.154/CVFeedData.svc/</value>
            </setting>
            <setting name="CVSyncErrorLog" serializeAs="String">
                <value>C:\Temp\Log\CVSyncError.log</value>
            </setting>
            <setting name="CVSyncLog" serializeAs="String">
                <value>C:\Temp\Log\CVSyncLog.log</value>
            </setting>
            <setting name="CVSyncReportLog" serializeAs="String">
                <value>C:\Temp\Log\CVSyncReport.log</value>
            </setting>
        </CVFeedMgmt.Properties.Settings>
    </userSettings>
</configuration>

更新 将工作文件夹更改为其他名称即可解决问题

0 个答案:

没有答案