wcf、webservivce、remoting、wse、Enterprise Service、msmq.... 乱谈

前阵子刚听说后十年是soa和并行计算的,现在又来后十年是移动终端的 虽说不矛盾但是也不和谐,这个就不多扯了

wcf

Windows Communication Foundation (WCF) 是 Microsoft 为构建面向服务的应用程序而提供的统一编程模型。借助这一模型,开发人员可以构建既能跨平台与现有投资集成又能与现有投资交互的安全、可靠的事务处理解决方案。

webservivce (ASMX)

ASP.NET Web 服务 (ASMX)。这种技术用于与基于 J2EE 的现有预定应用程序,以及与 Internet 上的合作伙伴应用程序进行通信。因为目前大多数平台都支持基本的 Web 服务,所以在 WCF 发布之前,这是实现跨供应商互操作性的最直接的方法。

remoting

NET Framework 远程处理。这种技术可用于与呼叫中心应用程序进行通信,因为二者都是建立在 .NET Framework 之上的。远程处理专门为紧密耦合的 .NET 到 .NET 通信而设计,因此它为本地网络中的应用程序提供了无缝而直接的开发体验。
Enterprise Service

 企业服务。租车预定应用程序使用该技术来管理对象生存期和定义分布式事务。在与此应用场景中的任何其他应用程序通信和集成时,这些功能会很有用,但是企业服务仅支持有限的一组通信选项。
WSE

可与 ASMX 一起使用,以便与基于 J2EE 的预定应用程序以及合作伙伴应用程序进行通信。它实现了最新定义的一些 Web 服务协议(统称 WS-* 规范),因此只要相关所有应用程序都支持这些新规范的兼容版本,WSE 就可提供更加灵活的 Web 服务安全性。
MSMQ

Microsoft 消息队列 (MSMQ)。用于与基于 Windows 的合作伙伴应用程序进行通信,这些应用程序对数据传送、工作量分离以及应用程序生存期均要求有保证。消息队列提供持久稳定的消息传送,这通常是间歇式连接的应用程序的最佳解决方案。

 

WCF的传输协议

◆BasicHttpBinding不支持可靠性,BasicHttpBinding面向旧的ASMX Web服务,是不具有可靠性的;

◆NetMsmqBinding不支持可靠性,MSMQ协议,使用消息队列,针对断开调用,不存在传输会话;             

◆MsmqIntegrationBinding不支持可靠性;支持WCF与MSMQ协议通信,不存在传输会话;

◆NetPeerTcpBinding不支持可靠性。NetPeerTcpBinding则为广播场景设计。

◆WSDualHttpBinding支持可靠性的,建立两个http会话通道,保持回调通道,确保基于HTTP协议的客户端存在;

◆NetTcpBinding 支持可靠性,显然使用TCP传输数据。以及各种WS绑定,默认情况下并不支持可靠性,允许启用;    

◆NetNamedPipeBinding绑定总是拥有一个确定的从客户端到服务的跳数,因而它的可靠性是绑定固有的;

◆WSFederationHttpBinding支持可靠性,支持联邦通信协议,支持在多个安全区域进行安全会话。

 

应用比较:

     wcf是WebService,Remoting,...之上的一层抽象,让程序员们以一种统一的方式去编写基于WebService或Remoting。。。的程序,而且它们之间的切换很简单,只需要改一下配置。 也就是说,开始服务以WS向外提供,因为需求改变,改为Remoting向外提供,只需要修改配置。WCF封装了各种不同实现的具体细节。WCF服务元数据是WCF服务的核心部分服务地址(Address)、绑定(通信协议Binding)、契约(服务、操作、数据Contract)的原始描述信息。

     WSE 3.0 仅支持安全框架,而 WCF 支持安全框架、可靠消息处理框架和事务框架。如表格所示,WCF 还提供更多的本地处理行为和自定义挂钩。实际上,WCF 对象模型中的每一层都可以通过代码、属性或配置进行扩展。最终,WCF 提供更完整的开发框架,该框架是围绕各种 Web 服务协议从头开始设计的。WSE支持WS-* 标准。WCF基本上实现了目前所有的WS-* 标准。

    ASMX基本的网络服务的互用性,Remoting TCP协议、.net与.net之间的交互通信,Enterprise Service的分布式事务,msmq的队列消息。WCF 同样具备。  

    WCF 定位为新的 .NET Web 服务平台,该平台可以完全替代现在对 现行分布式系统 所提供功能的需要。

 

性能比较:

Order[] GetOrders( int NumOrders);
{
            Order[] orders =  new Order[numOrders];
             for ( int i =  0; i < numOrders; i++)
            {
                Order order =  new Order();
                OrderLine[] lines =  new OrderLine[ 2];
                lines[ 0] =  new OrderLine();
                lines[ 0].ItemID =  1;
                lines[ 0].Quantity =  10;
                lines[ 1] =  new OrderLine();
                lines[ 1].ItemID =  2;
                lines[ 1].Quantity =  5;
                order.orderItems = lines;
                order.CustomerID =  100;
                order.ShippingAddress1 =  " 012345678901234567890123456789 ";
                order.ShippingAddress2 =  " 012345678901234567890123456789 ";
                order.ShippingCity =  " 0123456789 ";
                order.ShippingState =  " 0123456789012345 ";
                order.ShippingZip =  " 12345-1234 ";
                order.ShippingCountry =  " United States ";
                order.ShipType =  " Courier ";
                order.CreditCardType =  " XYZ ";
                order.CreditCardNumber =  " 0123456789012345 ";
                order.CreditCardExpiration = DateTime.UtcNow;
                order.CreditCardName =  " 01234567890123456789 ";
                orders[i] = order;
            }
             return orders;
}

 

 

 

string TransferFunds( int source,  int destination, Decimal amount);

Here the service just returns a  string  " successful " or  " failure "

For the order message the following code service  is used:

static  public ProductInfo CreateProductInfo( int count)
{
            ProductInfo productInfo =  new ProductInfo();

            productInfo.TotalResults = count.ToString();
            productInfo.TotalPages =  " 1 ";
            productInfo.ListName =  " Books ";
            productInfo.Details =  new Details[count];
             for ( int x =  0; x < count; x++)
            {
                productInfo.Details[x] = GetDetail();
            }
             return productInfo;
}

static Details GetDetail()
{
      Details details =  new Details();
      details.Url = 
" http://www.abcd.com/exec/obidos/ASIN/043935806X/qid=1093918995/sr=k
a- 1/ ref=pd_ka_1/ 103- 9470301- 1623821 " ;
      details.Asin =  " 043935806X ";
      details.ProductName =  " Any Book Available ";
      details.Catalog =  " Books ";
      details.ReleaseDate =  " 07/01/2003 ";
      details.Manufacturer =  " Scholastic ";
      details.Distributor =  " Scholastic ";
      details.ImageUrlSmall = 
" http://images.abcd.com/images/P/043935806X.01._PE60_PI_SZZZZZZZ_.jpg ";
      details.ImageUrlMedium = 
" http://images.abcd.com/images/P/043935806X.01._PE60_PI_MZZZZZZZ_.jpg ";
      details.ImageUrlLarge = 
" http://images.abcd.com/images/P/043935806X.01._PE60_PI_LMZZZZZZZ_.jpg ";
      details.ListPrice =  " 29.99 ";
      details.OurPrice =  " 12.00 ";
      details.UsedPrice =  " 3.95 ";
      details.Isbn =  " 043935806X ";
      details.MpaaRating =  "";
      details.EsrbRating =  "";
      details.Availability =  " Usually ships within 24 hours ";
       return details;
}

 

 


 

 

 

你可能感兴趣的:(service)