如何用代码方式获取Web.config中system.serviceModel/client节点的address
以下代码GetAPIAddress将返回:http://localhost:2555/APITEST.asmx
using System.Web.Configuration;
using System.ServiceModel.Configuration;
/// 获取Api地址
/// 返回system.serviceModel/client/endpoint节点address属性值
public static String GetAPIAddress
{
get
{
ClientSection clientSection = (ClientSection)WebConfigurationManager.GetSection("system.serviceModel/client");
if (clientSection != null
return clientSection.Endpoints[0].Address.AbsoluteUri;
return string.Empty;
}
}
Web.config配置信息:
一.Web.config中设置代码 <appSettings> <add key="deleted" value="1" ... 读取webconfig里面的appSetting和connectionString <appSettings> <add key="SiteURL" value= ... 这是我的第一篇文章,既然是第一篇了,那就从最基础的只是说起--web.config中配置数据库连接. 网上有很多这方面的资料,但发现并没有一篇从头到位很清楚明了说完的,今天就把我的整理写在这里吧. 在 ... 应用场景: 很多时候我们要在Web.Config中添加appSettings的键值对来标识一些全局的信息,比如:调用service的domain,跳转其他网站页面的url 等等: 那么此时就涉及到了一 ... 1: /// <summary> 2: /// 修改web.config或app.config文件appSettings配置节中的Add里的value属性 3: /// </summ ... 定义web.config 中 appSettings 节点 <appSettings> <add key="domainExist" value="fa ... 介绍 这篇文章我将介绍如何利用ASP.NET来加密和解密Web.config中连接字符串 背景描述 在以前的博客中,我写了许多关于介绍 Asp.net, Gridview, SQL Server, A ... 摘自:博客园 介绍 这篇文章我将介绍如何利用ASP.NET来加密和解密Web.config中连接字符串 背景描述 在以前的博客中,我写了许多关于介绍 Asp.net, Gridview, SQL Se ... 在一个正常的项目中,登录注册的密码是密文传输到后台服务端的,也就是说,首先前端js对密码做处理,随后再传递到服务端,服务端解密再加密传出到数据库里面.Dotnet已经提供了RSA算法的加解密类库,我们 ... "Ray, Pass me the dishes!" UVA - 1400 题意就是线段树区间子段最大和,线段树区间合并,但是这道题还要求输出最大和的子段的左右端点.要求字典序最小 ... 题目传送门 火星人 格式难调,题面就不放了. 分析: 这道题目不得不又让人感叹,还是$STL$大法好!!! $C++$的$algorithm$库中自带有$next\_permutation()$和$p ... 本文从消息循环是如何驱动程序的这个角度,对 Windows 消息循环进行概览性介绍. 使用 EN5 课件获得更好的阅读体验: [希沃白板5]课件分享 : <Windows培训 - 消息循环> ... 1.安装编译环境 yum groupinstall 'Development Tools' yum install zlib-devel bzip2-devel openssl-devel ncure ... [分析] 之前打的那种KM会TLE... why??明明说n^3的啊? #include<cstdio> #include<cstdlib> #include<cstri ... http://uoj.ac/problem/110 这道题subtask4和subtask5是不同的算法. 主要思想都是从高位到低位贪心确定答案. 对于subtask4,n比较小,设\(f(i,j)\ ... current($arr); 返回数组中的当前单元pos($arr); 返回数组中的当前单元key($arr); 返回数组中当前单元的键名prev($arr); 将数组中的内部指针倒回一位ne ... 有数据表 comments------------------------------------------------| id | newsID | comment | theTime |---- ... 现观目前市场上的APP横行,不同行业.不同类目的APP在国内各大应用市场挤爆的满满了,那么作为一个程序员或者一个企业如何能从容的把握住制作一款实用又符合用户体验的APP呢? 自从接触APP也有四年多了 ... unix下的binutils短小精悍,用胶水(俺经常成管道为胶水)紧密结合在一起释放巨大的能量.django的过滤器也学习了这个方式,每个版本的django都自带了一些builtin的filter,当 ...
<bindings>
<basicHttpBinding>
<binding name="http" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="885536000" maxBufferPoolSize="524288" maxReceivedMessageSize="885536000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="524288" maxArrayLength="524288" maxBytesPerRead="4096" maxNameTableCharCount="524288"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:2555/APITEST.asmx" binding="basicHttpBinding" bindingConfiguration="XXXX" contract="Service.XXXX" name="XXXX" />
</client>
</system.serviceModel>如何用代码方式获取Web.config中system.serviceModel/client节点的address的更多相关文章
随机推荐