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

两个彩票网站做赔付/上海seo优化公司

两个彩票网站做赔付,上海seo优化公司,龙泉驿城乡建设委员会网站,佛山购物网站建设前面为大家介绍过WCF的特点,现在再讲解一下WCF基础概念。 在WCF里,各个Application之间的通信是由EndPoint来实现的,EndPoint是WCF实现通信的核心要素。一个WCF Service可由多个EndPoint集合组成,每个EndPoint只能有一种绑定&…

  前面为大家介绍过WCF的特点,现在再讲解一下WCF基础概念。

  在WCF里,各个Application之间的通信是由EndPoint来实现的,EndPoint是WCF实现通信的核心要素。一个WCF Service可由多个EndPoint集合组成,每个EndPoint只能有一种绑定,就是说EndPoint就是通信的入口,客户端和服务端通过 EndPoint交换信息。

<service name = " " >
< endpoint address = "" binding = " wsHttpBinding " contract = " myNamespace.IService " >
</ endpoint >
</service>

  Endpoint由三部分组成:(A) Address 地址,(B)Binding 绑定,(C)Contract 契约。

  • A(Address): 通过一个URI唯一地标识一个Endpoint,并告诉WCF service的调用者如何找到这个Endpoint。
  • B(Binding): 定义了与数据传输相关的传输协议,消息编码,通信模式,可靠性,安全性,事务,互操作性等信息。Framewrok3.5里已经包括以下几种绑定:

  • C(Contract):它是有关服务响应的操作及进出消息的格式的语法描述,系统就是通过Contract实现操作的。

  下面为大家讲解一下Hello World的开发例子。

  服务器端:

using System;
using System.ServiceModel;
namespace myNamespace
{

//在服务器端定义在一个服务契约
[ServiceContract(Namespace = " myNamespace " )]
public interface IService
{
[OperationContract]
String HelloWorld();
}
//实现契约
public class MyService:IService
{
public String HelloWorld(string name)
{
return "Hello World"+Name;
}
}
}

  最后,服务既可以在代码中实现,也可以在配置文件中实现:

<services>
<service behaviorConfiguration="ServiceBehavior" name="Service">
//行为可以影响运行是操作的WCF类,它不公在客户端和服务器启动WCF运行时被执行,还可以在二者之间流动消息时被执行。
<endpoint address="" binding="wsHttpBinding" contract="IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
//mexHttpBinding定义了WCF的元数据。当没有定义元数据时,服务依然能够执行,但不能在HTTP中被发现。
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>

  客户端:

  通过Add Service Reference引用服务地址:

  添加配置文件:

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="wsHttpBinding_IService" closeTimeout="00:01:00"
openTimeout
="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies
="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize
="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

messageEncoding
="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead
="4096" maxNameTableCharCount="16384" />
<security mode="None">

<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/myNamespace.IService.svc" binding="wsHttpBinding"

bindingConfiguration
="wsHttpBinding_IService"

contract
="myNamespace.IService" name="wsHttpBinding_IService" />
</client>
</system.serviceModel>

    最后通过代理直接调用:

static void Main(string[] args)
{
ServiceClient client
=new ServiceClient();
string data=client.HelloWorld("Leslie");
Console.Writeline(data);
Console.Read();
}

  朋友,恭喜你,一个最简单Hello World的WCF已经实现。

  然而,如果你要开发一个SOA系统,你不可能将每一个类都编写成一个*.svc文件,那应该怎么做才能真正实现SOA?

  下一章将为你详细介绍如何使用WCF实现真正的SOA。

转载于:https://www.cnblogs.com/waw/archive/2011/09/01/2162901.html

http://www.jmfq.cn/news/5295547.html

相关文章:

  • 自适应网站做百度推广/中文搜索引擎排名
  • 如何做微信商城网站建设/培训机构咨询
  • 做购物网站的目的/网页制作在线生成
  • 网站建设补贴/深圳seo推广公司
  • 购物网站开发目的/爱站网收录
  • 深圳市企业网站seo营销工具/免费建一个自己的网站
  • 房地产网站制作公司/seo自动优化工具
  • html5做网站链接范例/真实的网站制作
  • 腾讯企业邮箱登录登录入口/重庆百度推广优化
  • wordpress陶哲轩/seo关键词排名优化怎样收费
  • 怎么模仿别人做网站/nba中国官方网站
  • 自己怎样做网站/小红书搜索关键词排名
  • 苏州奶茶加盟网站建设/苏州优化网站公司
  • 教育品牌网站建设/seo推广方式是什么呢
  • 广州建设网站下载/怎么创建网站快捷方式到桌面
  • linux建设视频网站/营销推广案例
  • 要建一个网站该怎么做/旺道营销软件
  • 百度网站名称/网站怎么优化关键词快速提升排名
  • 西安 网站 高端 公司/优化seo软件
  • 郑州汉狮做网站好不/信息流广告是什么意思
  • 做黄网站赚钱吗/seo研究中心vip教程
  • 西咸新区规划建设局网站/seo排名优化哪家好
  • 大兴安岭建设局网站/如何优化搜索引擎
  • 上海制作企业网站/名优网站关键词优化
  • 科技助手/沈阳seo优化排名公司
  • 网站的登录注册页面怎么做/网站seo设置是什么
  • 手机版免费个人简历模板/天津seo推广
  • 深圳市住房和建设局网站住房保障/宁波seo行者seo09
  • 钓鱼网站如何做/在线服务器网站
  • 一键生成网站/网络营销工程师