wcf

WCF,JQuery,JSON:

China☆狼群 提交于 2020-03-28 02:48:18
1.今天试验的目地是为了使用JQuery来调用WCF服务。 2.JQUERY调用WCF服务的写法: $.ajax({ type:"GET", http://www.cnblogs.com/wanghualiang/admin/%22http://192.168.3.17/DASStaff/StaffDemo.svc/GetStaffByStaffID ", data:"staffId=1", contentType:"application/json;character=utf-8", dataType:"json", processData:true, success:function(staff){ alert(_1); if (staff ==null) alert("null"); else alert(staff.toString()); } }); 3.遇到的问题 服务的调用很成功,但是在对象的解析中遇到了问题。 WCF服务返回的对象总是带有d的。不知道为什么。 目前只能先将d解析出来。 staff.d.StaffDisplayName. 来源: https://www.cnblogs.com/wanghualiang/archive/2010/04/09/1708476.html

is InstanceContextMode.Single available for WCF basicHttpBinding?

时光毁灭记忆、已成空白 提交于 2020-03-25 16:08:40
问题 As I understand from this article: Single: This will help us to share the data globally. We can create only one instance and the same instance will be reused on the subsequent calls. Same like Per Session this will work with all bindings except basicHttpBinding. InstanceContextMode.Single not available for basicHttpBinding. But according to this answer it works. This article adds confusion. I'd like to get clear answer and explanation. 回答1: InstanceContextMode.Single will force the WCF engine

How to convert x-www-form-urlencoded post Message to JSON post Message?

感情迁移 提交于 2020-03-25 13:38:35
问题 I have a requirement to support data being posted to our WCF service with a content type of x-www-form-urlencoded . Since WCF doesn't like to do that natively, the thought I had was to use a MessageInspector to intercept incoming messages with that content type, read out the body, convert it to a JSON string, and replace the request message. Problem is that I can't seem to make a new Message object that my service actually likes. I can get the body and turn it into a JSON string just fine,

How to convert x-www-form-urlencoded post Message to JSON post Message?

孤人 提交于 2020-03-25 13:38:10
问题 I have a requirement to support data being posted to our WCF service with a content type of x-www-form-urlencoded . Since WCF doesn't like to do that natively, the thought I had was to use a MessageInspector to intercept incoming messages with that content type, read out the body, convert it to a JSON string, and replace the request message. Problem is that I can't seem to make a new Message object that my service actually likes. I can get the body and turn it into a JSON string just fine,

WCF 404.3 MIME 映射错误

本小妞迷上赌 提交于 2020-03-25 08:42:33
WCF部署在IIS下,报错如下: HTTP 错误 404.3 - Not Found 由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。 可能是缺少处理程序映射。默认情况下,静态文件处理程序将处理所有内容。 您要使用的功能可能尚未安装。 没有为网站或应用程序启用相应的 MIME 映射。(警告: 请不要为用户不应下载的 .ASPX 页或 .config 文件等内容创建 MIME 映射。) 如果未安装 ASP.NET。 在 system.webServer/handlers 中: 确保映射了当前页所需的处理程序。 请特别注意前提(例如,runtimeVersion、pipelineMode、bitness)并将这些前提与应用程序池的设置进行比较。 请特别注意所需处理程序行中的书写错误。 请确认要使用的功能已经安装。 确认启用了 MIME 映射,或使用命令行工具 appcmd.exe 为网站添加 MIME 映射。 要设置 MIME 类型,请使用以下语法: %SystemRoot%\windows\system32\inetsrv\appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string'] 变量

一起了解 .Net Foundation 项目 No.21

烈酒焚心 提交于 2020-03-23 23:41:11
3 月,跳不动了?>>> Net 基金会中包含有很多优秀的项目,今天就和笔者一起了解一下其中的一些优秀作品吧。 中文介绍 中文介绍内容翻译自英文介绍,主要采用意译、如与原文存在出入,请以原文为准。 UWP Community Toolkit UWP Community Toolkit 包含一组帮助函数、自定义控件和应用服务。它为 Windows 10 UWP 开发这带来便利。 项目详情 项目源码 [样例]( https://aka.ms/uwptoolki tapp) 快速开始 项目许可证: MIT 项目联系人: David Catuhe aka Deltakosh 相关链接 开发文档 Github issues 参与贡献 笔者简评 目前项目已经被重命名为 WindowsCommunityToolkit 。几乎属于 UWP 开发所必备的一组类库。 英文介绍 UWP Community Toolkit The UWP Community Toolkit is a collection of helper functions, custom controls, and app services. It simplifies and demonstrates common developer tasks building UWP apps for Windows 10. Project

WCF Data Service QuickStart

泪湿孤枕 提交于 2020-03-23 22:14:50
开放数据协议 (OData) 是一个查询和更新数据的Web协议。OData是基于诸如HTTP和AtomPub的国际标准创建的,它提供了一个跨平台的数据通信的方案。OData应用了web技术如HTTP、Atom发布协议(AtomPub)和JSON等来提供对不同应用程序,服务和存储的信息访问。SharePoint 2010, SQL Server 2008 R2, PowerPivot, Windows Azure Table Storage, 和第三方的产品像 IBM’s WebSphere eXtreme Scale 都使用OData。 首先,WCF Data Services是WCF服务,所以你可以使用所有现有的WCF知识。其次,WCF Data Services已经实现了OData拓扑,于是你可以致力于你的数据格式在你的程序中的表示,而不是AtomPub/JSON这些真正在网络上传递的数据格式。再有,WCF Data Services致力于数据传输,而不是数据存储。你的数据可以存放在任何位置:本地的数据库,云端的数据库,外部的web services,xml文件,等等。无论数据是怎么来的,你都可以用同样的方式来发布/使用它们。 使用Visual Studio 2010里头使用WCF Data Service,就是使用OData发布的Restful服务

WCF后续之旅(10): 通过WCF Extension实现以对象池的方式创建Service Instance

北城余情 提交于 2020-03-23 11:32:07
我们知道WCF有3种典型的对service instance进行实例化的方式,他们分别与WCF的三种InstanceContextMode相匹配,他们分别是PerCall,PerSession和Single。PerCall为每次service invocation创建一个新的service instance; 而PerSession则让一个service instance处理来自通过各Session(一般是同一个proxy对象)的调用请求;而Single则是用同一个service instance来处理所有的调用请求。SOA的一个原则是创建无状态的service(stateless service),PerCall应该是我们经常使用的实例化方式,尽管PerSession是默认的InstanceContextMode。 但是对于PerCall这种实例化方式来说,为每次service请求都创建新的service instance,有时候显得有点极端,频繁的对象创建会对系统的性能造成一定的影响。我们能够以池的机制(Pooling)进行对象的获取和创建呢:当service调用请求抵达service端,先试图从池中获取一个没有被使用的service instance,如何找到,直接获取该对象;否则创建新的对象。当service instance对象执行完毕

WCF 跨域TCP绑定

夙愿已清 提交于 2020-03-23 10:59:02
Silverlight4在跨域访问TCP时会读取Http 80端口的跨域策略文件,可以放IIS上,也可以在服务控制台托管Http服务 例子是控制台托管TCP服务和Http跨域策略文件服务 配置文件: <?xml version="1.0"?> <configuration> <system.serviceModel> <services> <service name="ConsoleApplication1.DuxpexService"> <endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBindConfig" contract="ConsoleApplication1.IDuxpexService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress=" http://localhost:8732/DuxpexService/ " />

WCF后续之旅(9):通过WCF的双向通信实现Session管理[上篇]

China☆狼群 提交于 2020-03-23 10:55:31
我们都知道,WCF支持Duplex的消息交换模式,它允许在service的执行过程中实现对client的回调。WCF这种双向通信的方式是我们可以以Event Broker或者订阅/发布的方式来定义和调用WCFService。今天我们就给大家一个具体的例子:通过WCF的duplex communication方式现在Session管理。 1、Session 管理提供的具体功能 我们的例子实现了下面一些Session Management相关的功能: Start/End Session: 可以调用service开始一个新的Session或者结束掉一个现有的Session。当开始一个Session的时候,service根据client端传入的client相关的信息(ClientInfo),创建一个SessionInfo对象,该对象由一个GUID类型的SessionID唯一标识,代表一个具体的Client和Service的Session。在service端,通过一个dictionary维护者一个当前所有的activesession列表,key为SessionID,value是SessionInfo对象。当client调用相应的service,传入对应的SessionID,该SessionID对应的SessionInfo从该session列表中移除。 Session Timeout: