随笔分类 - 07_WCF
WCF
摘要:配置消息队列:1 控制面板\所有控制面板项\程序和功能->打开或关闭Windows功能。安装MSMQ http://www.cnblogs.com/rhythmK/2. 传统消息队列开发<单机模式>。 using System.Messaging; 2.1 接收端: static void ReadMessage() { string queueName = @".\Private$\SampleQueue"; MessageQueue mq = new MessageQueue(queueName); mq.Formatter = new XmlMess
阅读全文
摘要:契约:注意:所有传入的参数必须设置成字符串using System;using System.Collections.Generic;using System.ServiceModel;using Rhythmk.Model;using System.ServiceModel.Web;namespace Rhythmk.Contracts{ /// HTTP方法中: /// PUT相当于Update /// GET相当于Read /// POST相当于Create /// DELETE相当于Delete [ServiceContract] [DataContractFormat] public
阅读全文
摘要:契约:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;namespace Rhythmk.Contracts{ /// <summary> /// 对象在每次调用前创建,在调用后回收 /// </summary> [ServiceContract] public interface IPerCall { [OperationContract] void Add(); [OperationContract]
阅读全文
摘要:契约:namespace Rhythmk.Contracts{ [ServiceContract(Namespace="http://wwww.wangkun.com")] public interface ICalculate { [OperationContract] [TransactionFlow(TransactionFlowOption.Mandatory)] void OperationTransaction(int i); /* TransactionFlow - 指定服务操作是否愿意接受来自客户端的传入事务 NotAllowed - 禁止事务。默认值 Al
阅读全文
摘要:项目结构:Rhythmk.Contracts //契约Rhythmk.Services //服务Rhythmk.WCFSvc // 服务寄宿Rhythmk.test //测试-----------------------------------------------------------------说明:通过Session 去保证对象的一致性,通过绑定 binding="wsHttpBinding" 实现会话状态1.Rhythmk.Contracts //契约using System.ServiceModel; /// SessionMode - 获取或设置是否允许、不
阅读全文
摘要:2.WCF 同步 异步using System.ServiceModel;namespace Rhythmk.Contracts{ [ServiceContract(Namespace="http://wwww.wangkun.com")] public interface ICalculate { //通过 IsOneWay 实现无返回 异步调用 [OperationContract( IsOneWay=true)] void IsOneWay(); [OperationContract] void IsReturnWay(); }}-------------------
阅读全文
摘要:1.结构2.契约:using System.ServiceModel;using Rhythmk.Entity;namespace Rhythmk.Contracts{ [ServiceContract(Namespace="http://wwww.wangkun.com")] publicinterface ICalculate { [OperationContract(Name="AddServices")] double Add(double x, double y); /* Name :则体现在客户端调用此...
阅读全文
浙公网安备 33010602011771号