webserice与winform的app.config
我在一个应用程序中引用了一个webserice(app.config中自动把webserice路径写进去)
webserice如果发布路径是活的话.我怎么样在应用程序中修改(应用程序已经发布)
我现在有一个想法,就是用程序本身来修改app.config.可是我不知道如何来修改..
请高手.指点一下..如果不行的话,怎么作啊..
<?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= "brith.Properties.Settings " type= "System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 " requirePermission= "false " />
</sectionGroup>
</configSections>
<connectionStrings>
<add name= "brith.Properties.Settings.birdConnectionString " connectionString= "Data Source=SYTDC-JI7TFCDTG;Initial Catalog=bird;Persist Security Info=True;User ID=birth;Password=birth "
providerName= "System.Data.SqlClient " />
</connectionStrings>
<applicationSettings>
<brith.Properties.Settings>
<setting name= "brith_WebReference_Service " serializeAs= "String ">
<value> http://192.168.0.91:9000/Service.asmx </value>
</setting>
<setting name= "brith_WebReference1_Service " serializeAs= "String ">
<value> http://192.168.0.91:9000/Service.asmx </value>
</setting>
</brith.Properties.Settings>
</applicationSettings>
</configuration>
------解决方案--------------------这是我写的一个通过修改外部ini文件来解决webservices地址转向的问题,可以直接打开ini文件进行修改,也可以通过别的程序来修改。
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
using System.Xml;
using System.Data;
using System.Data.Common;
using System.Runtime.InteropServices;
using System.IO;
using System.Text;
[WebService(Namespace = "web ")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService