0
我需要在web服务中向AppSettings添加自定义值在webservice中为web.config添加值
我有这段代码,但没有任何反应。
procedure TWebService1.AddStrConn(KeyConn, ValueConn: String);
var
config : System.Configuration.Configuration;
begin
config:=ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetExecutingAssembly().Location);
config.AppSettings.Settings.Add(KeyConn,ValueConn);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection('appSettings');
end;
也尽量
procedure TWebService1.AddStrConn(KeyConn, ValueConn: String);
var
config : System.Configuration.Configuration;
begin
config:=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add(KeyConn,ValueConn);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection('appSettings');
end;
非常感谢。 – RRUZ 2009-06-12 08:36:09