Add appsettings node in app. Config, conn.open times initialization error

Source: Internet
Author: User

After adding the appsettings node in App. Config, run the following error to the Conn.Open times:

The type initializer for "System.Transactions.Diagnostics.DiagnosticTrace" throws an exception. "

The problem is resolved after placing the configsections node in the first element under the configuration, for unknown reasons.

Before you change your app. config:

<?xml version= "1.0" encoding= "Utf-8"?
<configuration>
    <appsettings
        <add key= "buscity" value= "Shanghai, Dongguan, Zhongshan, Lishui, Leshan, Foshan, Baoding, Beihai, Nanjing, Nanchong, Nanning, Nantong, Taizhou, Hefei, Tangshan, Anyang, Yibin, Bazhong, Changzhou, Changde, Guangyuan, Guangzhou, Deyang, Huizhou, Chengdu, Yangzhou, Panzhihua, Kunming, Zhaotong, Hangzhou, Shantou, Jiangmen, Taizhou, Luzhou, Huaian, Shenzhen, Qingyuan, Yantai, Yulin, Zhuhai, Suzhou, Quzhou, Dazhou, Suining, Zhengzhou, Chongqing, Zhenjiang, Changsha, Yangjiang, Yaan, Qingdao, Shaoguan "/>
        <add key=" Busid "value=" 398328,595874,662326,280787,352434,601492,357595,355542,293437,390110,354921,489828,280796,390186,622586,338884,352959,34 7956,283053,376904,351940,662530,351110,662499,348289,690040,390582,609990,621734,277073,673785,666466,327372,354010,2825 85,635260,666754,398034,357334,556102,611718,281511,352419,351093,347918,399907,419461,359516,655530,351904,397721,674569 "/>
    </appsettings>

<configSections>
<sectiongroup name= "usersettings" type= "System.Configuration.UserSettingsGroup, System, version=2.0.0.0, Culture =neutral, publickeytoken=b77a5c561934e089 ">
<section name= "TrainTickets.Properties.Settings" type= "System.Configuration.ClientSettingsSection, System, version=2.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089 "allowexedefinition=" MachineToLocalUser " Requirepermission= "false"/>
</sectionGroup>
</configSections>

</configuration>


After you change the app. config:

<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>

<configSections>
<sectiongroup name= "usersettings" type= "System.Configuration.UserSettingsGroup, System, version=2.0.0.0, Culture =neutral, publickeytoken=b77a5c561934e089 ">
<section name= "TrainTickets.Properties.Settings" type= "System.Configuration.ClientSettingsSection, System, version=2.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089 "allowexedefinition=" MachineToLocalUser " Requirepermission= "false"/>
</sectionGroup>
</configSections> <appSettings>
<add key= "buscity" value= "Shanghai, Dongguan, Zhongshan, Lishui, Leshan, Foshan, Baoding, Beihai, Nanjing, Nanchong, Nanning, Nantong, Taizhou, Hefei, Tangshan, Anyang, Yibin, Bazhong, Changzhou, Changde, Guangyuan, Guangzhou, Deyang, Huizhou, Chengdu, Yangzhou, Panzhihua, Kunming, Zhaotong, Hangzhou, Shantou, Jiangmen, Taizhou, Luzhou, Huaian, Shenzhen, Qingyuan, Yantai, Yulin, Zhuhai, Suzhou, Quzhou, Dazhou, Suining, Zhengzhou, Chongqing, Zhenjiang, Changsha, Yangjiang, Yaan, Qingdao, Shaoguan "/>
<add key= "Busid" value= " 398328,595874,662326,280787,352434,601492,357595,355542,293437,390110,354921,489828,280796,390186,622586,338884,352959,34 7956,283053,376904,351940,662530,351110,662499,348289,690040,390582,609990,621734,277073,673785,666466,327372,354010,2825 85,635260,666754,398034,357334,556102,611718,281511,352419,351093,347918,399907,419461,359516,655530,351904,397721,674569 "/>
</appSettings>



</configuration>


Add appsettings node in app. Config, conn.open times initialization error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.