C# Unrecognized configuration section system
系統(tǒng)
2752 0
公司的項目,由于老項目里面使用的是.net framework 2.0環(huán)境,而我們開發(fā)使用的卻是VS2008,所以在創(chuàng)建新的應(yīng)用的時候,把環(huán)境設(shè)置為.net frameword2.0。
這是一個客戶端界面程序,應(yīng)用到web服務(wù)。
但在運行的時候出現(xiàn)以下錯誤:
?
Code
2008
-
11
-
18
?
18
:
36
:
44
,
093
?[
352
]?DEBUG?UTrial.YHDClient.MainForm?[(
null
)]?
<
(
null
)
>
?
-
?System.Configuration.ConfigurationErrorsException:?Configuration?system?failed?to?initialize?
--->
?System.Configuration.ConfigurationErrorsException:?Unrecognized?configuration?section?system.serviceModel.?(D:\CMI\TMSEXE\YHDClient.exe.Config?line?
8
)
???at?System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean?ignoreLocal)
???at?System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors?schemaErrors)
???at?System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
???at?System.Configuration.ClientConfigurationSystem.EnsureInit(String?configKey)
???
---
?End?of?inner?exception?stack?trace?
---
???at?System.Configuration.ConfigurationManager.GetSection(String?sectionName)
???at?System.Xml.Serialization.XmlSerializerCompilerParameters.Create(String?location)
???at?System.Xml.Serialization.TempAssembly..ctor(XmlMapping[]?xmlMappings,?Type[]?types,?String?defaultNamespace,?String?location,?Evidence?evidence)
???at?System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[]?mappings,?Type?type)
???at?System.Web.Services.Protocols.SoapClientType..ctor(Type?type)
???at?System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
???at?
***
.CMIService.CMIClientService..ctor()?
in
?D:\CMI\TMSEXE\Web?References\CMIService\Reference.cs:line?
97
???at?
***
.MainForm.Login()?
in
?D:\CMI\TMSEXE\form\MainForm.cs:line?
67
?
上網(wǎng)找了下,只要把配置文件中的一段注釋掉就行了,見下面代碼
配置文件如下:
Code
<?
xml?version
=
"
1.0
"
?encoding
=
"
utf-8
"
?
?>
<
configuration
>
????
<
configSections
>
????????
<
sectionGroup?name
=
"
applicationSettings
"
?type
=
"
System.Configuration.ApplicationSettingsGroup,?System,?Version=2.0.0.0,?Culture=neutral,?PublicKeyToken=b77a5c561934e089
"
?
>
????????????
<
section?name
=
"
***.Properties.Settings
"
?type
=
"
System.Configuration.ClientSettingsSection,?System,?Version=2.0.0.0,?Culture=neutral,?PublicKeyToken=b77a5c561934e089
"
?requirePermission
=
"
false
"
?
/>
????????
</
sectionGroup
>
????
</
configSections
>
????
<!--
這一段要注釋掉
????
<
system.serviceModel
>
????????
<
bindings?
/>
????????
<
client?
/>
????
</
system.serviceModel
>
????
-->
????
<
applicationSettings
>
????????
<***
.Properties.Settings
>
????????????
<
setting?name
=
"
****
"
????????????????serializeAs
=
"
String
"
>
????????????????
<
value
>
http:
//
www.****.com/***Service.asmx</value>
????????????
</
setting
>
????????
<
/*
**.Properties.Settings>
????</applicationSettings>
</configuration>
?
?
C# Unrecognized configuration section system.serviceModel
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元