The company's project is used in the old project.. NET Framework 2.0 environment, but we are developing and using vs2008, so when creating a new application, set the environment. net frameword2.0.
This is a client interfaceProgramTo the web service.
However, the following error occurs during running:
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 evispace)
At system. xml. serialization. xmlserializer. frommappings (xmlmapping [] mappings, type)
At system. Web. Services. Protocols. soapclienttype.. ctor (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
After searching the Internet, just comment out a section of the configuration file, as shown below:Code
The configuration file is as follows:
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 >
<! -- Comment out this section
< 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>