在app.config中增加appSettings节点后,运行到conn.open时报如下错误:
“System.Transactions.Diagnostics.DiagnosticTrace”的类型初始值设定项引发异常。”
将configSections节点放到configuration下的第一元素后问题解决,原因未知。
app.config改动前:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="busCity"
value="上海,东莞,中山,丽水,乐山,佛山,保定,北海,南京,南充,南宁,南通,台州,合肥,唐山,安阳,宜宾,巴中,常州,常德,广元,广
州,德阳,惠州,成都,扬州,攀枝花,昆明,昭通,杭州,汕头,江门,泰州,泸州,淮安,深圳,清远,烟台,玉林,珠海,苏州,衢州,达州,遂宁,郑州,
重庆,镇江,长沙,阳江,雅安,青岛,韶关"/>
<add key="busId"
value="398328,595874,662326,280787,352434,601492,357595,355542,293437,390110,354921,489828,280796,390186,622586,338884,352959,347956,283053,376904,351940,662530,351110,662499,348289,690040,390582,609990,621734,277073,673785,666466,327372,354010,282585,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>
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="上海,东莞,中山,丽水,乐山,佛山,保定,北海,南京,南充,南宁,南通,台州,合肥,唐山,安阳,宜宾,巴中,常州,常德,广元,广
州,德阳,惠州,成都,扬州,攀枝花,昆明,昭通,杭州,汕头,江门,泰州,泸州,淮安,深圳,清远,烟台,玉林,珠海,苏州,衢州,达州,遂宁,郑州,
重庆,镇江,长沙,阳江,雅安,青岛,韶关"/>
<add key="busId"
value="398328,595874,662326,280787,352434,601492,357595,355542,293437,390110,354921,489828,280796,390186,622586,338884,352959,347956,283053,376904,351940,662530,351110,662499,348289,690040,390582,609990,621734,277073,673785,666466,327372,354010,282585,635260,666754,398034,357334,556102,611718,281511,352419,351093,347918,399907,419461,359516,655530,351904,397721,674569"/>
</appSettings>
</configuration>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。