当前位置: 首页 > news >正文

网站建设毕业论文5000字/搜索引擎排名的三大指标

网站建设毕业论文5000字,搜索引擎排名的三大指标,交做网站视频百度云,佛山今日头条在WCF应用callback模式时,一些指导性的document给出的建议是将callback contract内的operation的Message Exchange Pattern设置为IsOneWay. 当然,当service调用callback而不需要从client instance获得callback的return value的时候,MEP设置为…

在WCF应用callback模式时,一些指导性的document给出的建议是将callback contract内的operation的Message Exchange Pattern设置为IsOneWay.

当然,当service调用callback而不需要从client instance获得callback的return value的时候,MEP设置为IsOneWay不失为最好的选择了。但是如果在某些应用场景下,我们需要获得客户端callback结果时候,就不能将MEP设置为IsOneWay=true了。

当然,当MEP设置为IsOneWay=false的时候,其他同步设置必须相应match,即ConcurrentMode只能为ReEntrant或者Multiple。

下面给出一个简单的应用模式:在线实时投票。

其简单系统模型如下:

WCF service提供一个简单的投票服务,收集投票结果通过callback机制得到各个client的结果后然后返回给service,然后WCF service给出statistics.

 针对这样的投票模型,在设置service的时候需要注意的是:

1.callback contract中的operation一定要设置为IsOneWay=false。否则callback无法return至服务端

2.ConcurrentMode不能设置为Single,而只能为ReEntrant或者Multiple.

3. 当service callbacks client的时候,callback result的处理权在service,比如对结果进行统计处理等等。

下面给出主要的source code:

callback contract和service contract的定义

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace WCFCallBack
{
    [ServiceContract]
    
public interface ICaculatorCallBack
    {
        [OperationContract]
        
int Equals(int result);
    }

    [ServiceContract(CallbackContract
=typeof(ICaculatorCallBack))]   
    
public interface ICaculatorService
    {
        [OperationContract]
        
void AddTo(int n);

        [OperationContract]
        
void Register();
    }
}

servicecontract implementation以及消息发布

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace WCFCallBack
{
    
public class AddEventAgrs : EventArgs
    {
       
public int result;
    }

    [ServiceBehavior(ConcurrencyMode
=ConcurrencyMode.Reentrant)]
    
class CaculatorService:ICaculatorService
    {
        
public delegate void AddEventHandler(object sender, AddEventAgrs e);
        
public static event AddEventHandler OnAddCompleted;
        
public ICaculatorCallBack callback;
        
public int result;

        
public CaculatorService()
        {
            result 
= 0;
            Console.WriteLine(
"A Calculator Instance is constructed");
        }

        
public void Register()
        {
            callback 
= System.ServiceModel.OperationContext.Current.GetCallbackChannel<ICaculatorCallBack>();
            OnAddCompleted 
+= new AddEventHandler(CaculatorService_OnAddCompleted);
        }


        
void CaculatorService_OnAddCompleted(object sender, AddEventAgrs e)
        {
            Console.WriteLine(
"the OnAdd event has been triggered");
            Console.WriteLine(
"the callback result from client is "+callback.Equals(e.result));

        }

        
public void BroadAddEvent(AddEventAgrs e, AddEventHandler temp)
        {
            
if (OnAddCompleted != null)
            {
                
foreach (AddEventHandler handler in temp.GetInvocationList())
                {
                    handler.BeginInvoke(
this, e, nullnull);
                }
            }
        }
       
        
public void AddTo(int n)
        {
            AddEventAgrs e 
= new AddEventAgrs();
            
this.result += n;
            e.result 
= result;
            BroadAddEvent(e, OnAddCompleted);
        }
    }
}

client1 callback实现:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WCFClient
{
    
class CallBack:ICaculatorServiceCallback
    {
        
public int Equals(int n)
        {
            
//Console.WriteLine("haha");
            Console.WriteLine("this callback is implemented on client,the callback result is {0}", n.ToString());
            
return 2*n ;
        }
    }
}

client2 callback implementation

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WCFClient
{
    
class CallBack:ICaculatorServiceCallback
    {
        
public int Equals(int n)
        {
            Console.WriteLine(
"I have received a broadcasting news,the callback result is {0}", n.ToString());
            System.Threading.Thread.Sleep(
2000);
            
return n * n;
        }
    }
}

运行结果:

service screenshot

client1 screenshot

client 2 screenshot

转载于:https://www.cnblogs.com/Winston/archive/2008/12/02/1345647.html

http://www.lbrq.cn/news/828775.html

相关文章:

  • 网页与网站的区别/百度竞价排名商业模式
  • 西安建筑网站建设/宁波seo外包推广排名
  • 国外优秀设计网站/seo交流
  • 坪山网站开发/百度广告大全
  • asp.net做的音乐网站/推广工作的流程及内容
  • 个人摄影网站模版/网站竞价推广都有哪些
  • 做静态网站软件/优化大师的三大功能
  • 毕设做网站和app/网推团队
  • 公司网站域名如何续费/百度客服投诉中心
  • 宜春的网站建设公司/手机网页设计制作网站
  • 沈阳企业网站建设公司/知识营销
  • 做网站怎么加弹幕/网络推广公司口碑
  • 短视频免费素材网站/人工智能培训机构
  • 以投资思维做网站/second是什么意思
  • 建立购物网站 app/2023新闻摘抄大全
  • 上海市建设局官方网站/金花关键词工具
  • 免费可以做旅游海报 的网站/有什么好用的搜索引擎
  • 做网站什么商品好/bt磁力猪
  • 哈尔滨网站优化/全网引流推广
  • 河南省建设厅督察网站/百度灰色关键词技术
  • 怎么做网站小编/微商怎么引流被加精准粉
  • 安徽康东建设工程有限公司网站/长沙seo网络推广
  • 服装饰品网站建设/360网站关键词排名优化
  • 宁夏建设工程质量安全监督总网站/如何做网页设计
  • 企业网站建设可以分为几个层次/域名注册服务机构
  • 一个网站如何做推广方案设计/百度的网址是什么
  • 做网站谈单/百度认证有什么用
  • 河北邯郸封闭最新消息/东莞网络推广优化排名
  • 网站开发报价说明/网站推广优化方法
  • 西安那里做网站/地推app接任务平台
  • 加法速算之尾数法
  • [论文阅读] 人工智能 + 软件工程 | 强化学习在软件工程中的全景扫描:从应用到未来
  • 【C++基础】--多态
  • FastAdmin系统框架通用操作平滑迁移到新服务器的详细步骤-优雅草卓伊凡
  • MyBatis 之配置与映射核心要点解析
  • 2025年5大国产ETL工具横向评测