配置系统无法初始化C#winforms



由于配置系统错误而无法启动,我的桌面应用程序无法运行
错误为

系统。TypeInitializationException:"系统的类型初始值设定项。数据SqlClient。SqlConnection"引发异常。"ConfigurationErrorsException:无法识别的配置节legacyUnhandledExceptionPolicy。(E:\visual studio projects\Windows窗体应用程序教程\ Time Doctor App\Time Doctor App \bin\x86\Debug\Ezi Tasker 2.0.exe。配置行18(

如何解决此问题?我已经做了很多更改,但它给了我一个抛出的初始值设定项和异常类型的错误。
线路为Ezi Tasker 2.0.exe.Config line 18

这是我的App.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="Signature" type="System.Configuration.IgnoreSectionHandler" />

<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, 
Version=4.0.0.0, Culture=neutral, PublicKeyToken=tooken" >
<section name="Time_Doctor_App.Properties.Settings" 
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=token" allowExeDefinition="MachineToLocalUser" requirePermission="false" 
/>

</sectionGroup>
</configSections>
<system.windows.forms jitDebugging="true" />
<connectionStrings>
<add name="Conec" connectionString="conecstring"
providerName="System.Data.SqlClient" />
</connectionStrings>
<legacyUnhandledExceptionPolicy enabled='1'/>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="token" 
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="token" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<userSettings>
<Time_Doctor_App.Properties.Settings>
<setting name="User" serializeAs="String">
<value />
</setting>
<setting name="Pass" serializeAs="String">
<value />
</setting>
</Time_Doctor_App.Properties.Settings>
</userSettings>
</configuration>

<legacyUnhandledExceptionPolicy enabled='1'/>元素必须是<runtime>元素的子元素,因此将其移动到那里:

</connectionStrings>
<runtime>
<legacyUnhandledExceptionPolicy enabled='1'/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

最新更新