随笔分类 -  WCF

摘要:Web.config配置 ... 阅读全文
posted @ 2014-04-30 16:31 Bug山Bug海 阅读(377) 评论(0) 推荐(0)
摘要:WCF Ajax在输出时会自动将字符串编码,所以不需要进行人工编码,不然会出错如”\tt\aa“,WCF传递到web页面时会是”\\tt\\aa“,而页面javascript得到值后会自动解码,变回”\tt\aa“但是如果在WCF服务中对字符串进行了HttpUtility.JavaScriptStringEncode(),输出到客户端的字符串会是\\\\tt\\\\aa,javascript解码后是\\tt\\aa所以在WCF Ajax不需要也不能对字符数据做额外编码处理,否则客户端会得到意外的结果 阅读全文
posted @ 2012-08-03 18:01 Bug山Bug海 阅读(196) 评论(0) 推荐(0)
摘要:Silverlight4在跨域访问TCP时会读取Http 80端口的跨域策略文件,可以放IIS上,也可以在服务控制台托管Http服务例子是控制台托管TCP服务和Http跨域策略文件服务配置文件:<?xml version="1.0"?><configuration> <system.serviceModel> <services> <service name="ConsoleApplication1.DuxpexService"> <endpoint address="" 阅读全文
posted @ 2012-05-01 00:27 Bug山Bug海 阅读(306) 评论(0) 推荐(0)
摘要:跨域服务:特性WebGet在System.ServiceModel.Web中View Code [ServiceContract] public interface IDomainService { [OperationContract] [WebGet(UriTemplate = "ClientAccessPolicy.xml")] Message ProvidePolicyFile(); } public class DomainService:IDomainService { #region I... 阅读全文
posted @ 2012-04-30 16:46 Bug山Bug海 阅读(648) 评论(0) 推荐(0)
摘要:服务端类代码服务契约: [ServiceContract(CallbackContract=typeof(IserviceCallBack))] public interface IService1 { [OperationContract] string GetData(int value); } public interface IserviceCallBack { [OperationContract] string GetClientData(); }服务实例: [ServiceBeh... 阅读全文
posted @ 2012-04-30 00:36 Bug山Bug海 阅读(160) 评论(0) 推荐(0)
摘要:View Code using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;using System.ServiceModel.Channels;using System.ServiceModel.Description;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { ... 阅读全文
posted @ 2012-04-29 23:55 Bug山Bug海 阅读(308) 评论(0) 推荐(0)
摘要:此方法一般用于Web,部署环境经常变化导致IP经常变动例子是Silveright调用同域WCF服务的方法 WordGameServiceClient GetClient() { BasicHttpBinding basicbind = new BasicHttpBinding(BasicHttpSecurityMode.None); BinaryMessageEncodingBindingElement binE = new BinaryMessageEncodingBindingElement(); ... 阅读全文
posted @ 2012-04-29 13:13 Bug山Bug海 阅读(206) 评论(0) 推荐(0)