zoukankan      html  css  js  c++  java
  • 清风乱谈 之 基于WCF的电子商务解决方案(一)

    首先,先用这个图片来说明我上次提到的多个组件服务器与WEB服务器之间的关系

     

    这么做至少有3个明显的好处:

    1.         将站点的压力平均化,提高网站的浏览速度,降低服务器压力。

    2.         保证各个应用组件之间逻辑的绝对分离,实现了我们说的低耦合。

    3.         应用服务器的接口可以多次复用,企业可以通过重新组合应用服务器接口建立统一的电子商务体系。

     

     

    该程序在VS2008下的结构如下:

     

    其中Orders对应着 订单管理组件服务系统”,Products对应着“产品目录管理组件服务系统”,Marketing对应着“市场营销及促销组件服务系统”,多个组件可以以IIS为宿主分别架设在多台服务器上。

     

     

    这里是IIS宿主站点的配置:

     

     

    以下为WEB服务器对组件服务器接口的调用方法:

    public void UpdateQuantity(Guid productID, int quantity)

            {

                //此处为对产品目录管理组件服务系统中提供的Product GetProductByID(Guid productID);接口的调用

                Product product = ServiceLoader.LoadService<IProduct>().GetProduct(productID);

                if (product.Inventory < quantity)

                {

                    throw new BusinessException("Lack of inventory.");

                }

                OrderDetail detail = this.Order.Details.Where(item => item.ProductID == productID).ToArray<OrderDetail>()[0];

                detail.Quantity = quantity;

                this.View.BindingOrderInfo(this.Order);

            }

     

     

     

    这段为接口调用在WEB.CONFIG文件里面的相关配置代码

    <client>

                  <endpoint address="http://localhost/PetShop/Products/productservice.svc" behaviorConfiguration="petShopBehavior"binding="ws2007HttpBinding"  contract="Artech.PetShop.Products.Service.Interface.IProductService" name="productservice"/>

                  <endpoint address="http://localhost/PetShop/Infrastructures/MembershipService.svc" behaviorConfiguration="petShopBehavior"binding="ws2007HttpBinding"  contract="Artech.PetShop.Infrastructures.Service.Interface.IMembershipService" name="membershipservice"/>

                  <endpoint address="http://localhost/PetShop/Orders/OrderService.svc" behaviorConfiguration="petShopBehavior" binding="ws2007HttpBinding" contract="Artech.PetShop.Orders.Service.Interface.IOrderService" name="orderservice"/>

             </client>

     

  • 相关阅读:
    day 66 ORM django 简介
    day 65 HTTP协议 Web框架的原理 服务器程序和应用程序
    jQuery的事件绑定和解绑 事件委托 轮播实现 jQuery的ajax jQuery补充
    background 超链接导航栏案例 定位
    继承性和层叠性 权重 盒模型 padding(内边距) border(边框) margin 标准文档流 块级元素和行内元素
    属性选择器 伪类选择器 伪元素选择器 浮动
    css的导入方式 基础选择器 高级选择器
    03-body标签中相关标签
    Java使用内存映射实现大文件的上传
    正则表达式
  • 原文地址:https://www.cnblogs.com/kelamayi/p/1731508.html
Copyright © 2011-2022 走看看