怎样使用web.config
来源:互联网 发布:java web 视频播放 编辑:程序博客网 时间:2024/05/17 23:06
通过帮助文件问题解决了,代码共分享:
// 服务端svc
[OperationContract]
public string get_web_config_appSettings_value(string path,string key)
{
string _value = "";
System.Configuration.Configuration rootWebConfig1 = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(path);
if (0 < rootWebConfig1.AppSettings.Settings.Count)
{
System.Configuration.KeyValueConfigurationElement customSetting = rootWebConfig1.AppSettings.Settings[key];
if (null != customSetting) _value = customSetting.Value;
}
return _value;
}
// silverlight端
_subject = new madamingSubject(@"../Services/Service1.svc");
_subject.WCF.get_web_config_appSettings_valueCompleted += new EventHandler<ServiceReference1.get_web_config_appSettings_valueCompletedEventArgs>(WCF_get_web_config_appSettings_valueCompleted);
private void hyperlinkbutton_调试_Click(object sender, RoutedEventArgs e)
{
Uri _uri = new Uri(Application.Current.Host.Source, @"../");
//string path = string.Format("AbsolutePath: {0}\nAbsoluteUri: {1}\nDnsSafeHost: {2}\nHost: {3}\nLocalPath: {4}\nToString: {5}", _uri.AbsolutePath, _uri.AbsoluteUri, _uri.DnsSafeHost, _uri.Host, _uri.LocalPath, _uri.ToString());
//MessageBox.Show(path);
_subject.WCF.get_web_config_appSettings_valueAsync(new Uri(Application.Current.Host.Source, @"../").LocalPath, "MapTileImagesURL");
}
private void WCF_get_web_config_appSettings_valueCompleted(object sender, ServiceReference1.get_web_config_appSettings_valueCompletedEventArgs e)
{
_subject.地图源 = e.Result;
textblock_副标题.Text = string.Format("[地图源:{0}]", _subject.地图源);
// MessageBox.Show(e.Result );
}
// 服务端svc
[OperationContract]
public string get_web_config_appSettings_value(string path,string key)
{
string _value = "";
System.Configuration.Configuration rootWebConfig1 = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(path);
if (0 < rootWebConfig1.AppSettings.Settings.Count)
{
System.Configuration.KeyValueConfigurationElement customSetting = rootWebConfig1.AppSettings.Settings[key];
if (null != customSetting) _value = customSetting.Value;
}
return _value;
}
// silverlight端
_subject = new madamingSubject(@"../Services/Service1.svc");
_subject.WCF.get_web_config_appSettings_valueCompleted += new EventHandler<ServiceReference1.get_web_config_appSettings_valueCompletedEventArgs>(WCF_get_web_config_appSettings_valueCompleted);
private void hyperlinkbutton_调试_Click(object sender, RoutedEventArgs e)
{
Uri _uri = new Uri(Application.Current.Host.Source, @"../");
//string path = string.Format("AbsolutePath: {0}\nAbsoluteUri: {1}\nDnsSafeHost: {2}\nHost: {3}\nLocalPath: {4}\nToString: {5}", _uri.AbsolutePath, _uri.AbsoluteUri, _uri.DnsSafeHost, _uri.Host, _uri.LocalPath, _uri.ToString());
//MessageBox.Show(path);
_subject.WCF.get_web_config_appSettings_valueAsync(new Uri(Application.Current.Host.Source, @"../").LocalPath, "MapTileImagesURL");
}
private void WCF_get_web_config_appSettings_valueCompleted(object sender, ServiceReference1.get_web_config_appSettings_valueCompletedEventArgs e)
{
_subject.地图源 = e.Result;
textblock_副标题.Text = string.Format("[地图源:{0}]", _subject.地图源);
// MessageBox.Show(e.Result );
}
- 怎样使用web.config
- Web.config文件使用
- Web.config文件使用
- Web.config文件使用
- web.config的使用
- Web.Config使用
- Web.config如何使用
- 使用Web.config
- Web.config的参数使用
- Web.config文件的使用
- 话说web.config之使用
- Web.Config:ConfigurationSection 使用示例
- 怎样从web.config中读取连接字符串的设置
- 使用web.config配置应用程序参数
- [原创]使用web.config连接数据库
- 使用代码快速配置 Web.config
- 使用aspnet_regiis加解密web.config
- 如何使用web.config里的sectiongroup
- Difference between Statement and preparedStatement
- What is difference between abstract class and interface
- SSAS-实用的DMV查询
- LinkedList vs ArrayList
- asp.net Inherits、Src、CodeBehind区别
- 怎样使用web.config
- 初涉Androidの笔记
- Calendar和Date深度剖析
- 关于 Cursor
- Androidの广播与服务
- Android学习笔记
- Intent中的四个重要属性
- android系统action
- Struts2中有关struts-default.xml,struts.xml,struts.properties文件详解