js.net 多语言&web service 添加服务引用和web 引用
来源:互联网 发布:淘宝兼职按照月结 编辑:程序博客网 时间:2024/04/28 04:34
web service 添加服务引用和web 引用的区别
http://www.sjsjw.com/102/002329MYM001841/
在软件发布后,动态的修改引用地址的配置方法
注意这里我使用的是新版本的service 引用方式;
当你添加一个service reference后,会在对应的项目下生成一个app.config文件:(如下)
<?xml version="1.0" encoding="utf-8" ?><configuration> <configSections> </configSections> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="PointStoreServiceSoap" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:25548/PointStoreService.asmx" binding="basicHttpBinding" bindingConfiguration="PointStoreServiceSoap" contract="PointStoreService.PointStoreServiceSoap" name="PointStoreServiceSoap" /> </client> </system.serviceModel></configuration>其中需要注意的是:
①basicHttpBinding节点下的<binding >,每天加一个service reference后,会生成一个binding节点。
②client节点下的endpoint,每添加service reference,也会增加一个endpoint节点。
如果添加webservice引用的项目是一个类库,那么就需要在网站的web.config下添加响应的模块来供类库读取。即在web.config配置文件中添加如下部分:
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="1111111111111" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="6553600" maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="320" maxStringContentLength="8192000" maxArrayLength="163840" maxBytesPerRead="40960" maxNameTableCharCount="163840" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://1111111111111111111111111.asmx" binding="basicHttpBinding" bindingConfiguration="11111111111" contract="1111111111111111" name="11111111111" /> </client> </system.serviceModel>以上xml节的结构就是app.config配置文件中的相同,只是添加了一些属性进行限制(对于每个属性的含义,大家有需要可以internet 查查。)显然,binding 节点的name属性和endpoint节点是可以直接从app.config copy过来的;
以上over
js多语言,定义两个js文件 如en-US.js, zh-CN.js
后端定义 public string Language
<script type="text/javascript" src="<%=Language%>.js"></script>
http://www.cnblogs.com/chenxizhang/archive/2009/11/28/1612595.html
bat文件,保存为resource.bat
rem Compile...
call "%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"call resgen.exe en-US.resx
call resgen.exe zh-CN.resx
调用方法
public static string GetTransText(string key)
{
var filePath = HttpContext.Current.Server.MapPath("~/Resource");
string language = HttpContext.Current.Session["CurrentLang"] == null ? "zh-CN":
HttpContext.Current.Session["CurrentLang"].ToString();
string resxPath = string.Format(@"{0}\{1}.resources", filePath, language);
using (ResourceReader reader = new ResourceReader(resxPath))
{
var evalue = reader.Cast<DictionaryEntry>().FirstOrDefault<DictionaryEntry>(x => x.Key.ToString() == key);
return evalue.Value == null ? string.Empty : entry.Value.ToString();
}
}
- js.net 多语言&web service 添加服务引用和web 引用
- 添加web引用和添加服务引用有什么区别?Add Service References 和 Add Web References 有啥区别?
- 添加web引用和添加服务引用有什么区别?
- 服务引用和web引用
- VS2008 添加service引用和web引用的区别
- 动态添加对Web Service的引用
- 动态添加对Web Service的引用
- 动态添加对Web Service的引用
- 动态添加对Web Service的引用
- 动态添加对Web Service的引用
- VS 添加web引用和添加服务引用有什么区别(转)
- 简单添加Web服务引用---天气预报
- 动态引用Web Service
- 基础知识--添加服务引用与Web引用的区别
- C# Web Service 根据WSDL文件和地址添加web引用
- 关于WCF的引用,添加服务和添加web服务的区别
- 禁止添加web引用
- 动态添加web引用
- 数据结构基本八大排序算法
- sysbench 说明
- 在 GO 编程语言中处理 JSON 数据
- (九)建造者模式
- Kotlin初体验
- js.net 多语言&web service 添加服务引用和web 引用
- 解决 ecshop 资金管理的权限问题
- RecyclerView 解析
- 手把手教你使用Git
- android进程间通信之Broadcast
- MySQL 初次装时密码为空 为其设置新密码
- 2016.2.17问题总结
- caffe学习笔记11 -- Net Surgery
- Tomcat Server.xml详解