如何用代码方式获取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算法的加解密类库,我们 ... 本文实际上想说的是ios8下 1px解决方案. 1px的边框在devicePixelRatio = 2的retina屏下会显示成2px,在iphone 6 plug 下,更显示成3px.由其影响美感. ... 通过管道技术降低往返时延 当后一条命令不依赖于前一条命令的返回结果时,可以使用管道技术将多条命令一起 发送给redis服务器,服务器执行结束之后,一起返回结果,降低了通信频度. <TP5 视频教程课程内容> 一.ThinkPHP5TP5 官网基础教程, 官网手册作为参考,讲解TP5的使用方法.理解TP的用途 二.TP5大型项目实战及底层源码分析用TP5 做大型电商 ... 4503: 两个串 Time Limit: 20 Sec Memory Limit: 256 MBSubmit: 497 Solved: 226 Description 兔子们在玩两个串的游戏.给 ... 2594: [Wc2006]水管局长数据加强版 Time Limit: 25 Sec Memory Limit: 128 MBSubmit: 4452 Solved: 1385[Submit][S ... http://codevs.cn/problem/3160/ 后缀自动机板子题,匹配的时候要注意如果到一个点失配向前匹配到一个点时,此时的tmp(当前匹配值)为t[j].len+1而不是t[t[j]. ... import java.util.Scanner; public class Exercise07_21 { /** * @param 冰樱梦 * 时间:2018年12月 * 题目:整数求和 */ p ... E. New Reform 题目连接: http://www.codeforces.com/contest/659/problem/E Description Berland has n cities ... Buildings 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5301 Description Your current task is to m ... Head: JavaScript -> Navbar Menu: JavaScript -> Collapse Compnents -> Panels Compnents -> ...
<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的更多相关文章
随机推荐