zoukankan      html  css  js  c++  java
  • 基于异步的MVC webAPI控制器

    MVC – Task-based Asynchronous Pattern (TAP) – Async Controller and SessionLess Controller

    In async programming, there are 3 different models for different scenarios :

    • Asynchronous Programming Model – APM
    • Task Based Asynchronous Programming Model – TAPM
    • Evented Asynchronous Programming Model – EAPM

    We can use all models in .net framework. It provides related libraries in their own namespaces. The Task-based Asynchronous Pattern (TAP) is based on System.Threading.Tasks.Task and System.Threading.Tasks.Task<TResult> types in the System.Threading.Tasks namespaces.

    When we’re developing web application, if we need to develop async applications on web side, we can use this libraries to reflect async behavior. For Instance, if we want to communicate external services or channels at the same time, we might use async controller to avoid operation blocks. When we’re reflecting this behavior in an application, We should think tasks in action level. I mean, surely according to our scenario, if we seperate all actions as different tasks, it can be more useful and manageble.

    In .Net Framework MVC Applications, We can use Async Controllers and async actions. For instance please check code below :

    And also, if you need to run multiple requests concurrently, use SessionLess controller :

    AST

    This entry was posted in .Net FrameworkASP.NetDesign PatternsMVCServer Side Web Programming,Web Programming and tagged  on July 4, 2016.

  • 相关阅读:
    hadoop配置支持LZO压缩格式并支持分片
    CSS 图片:如何使用 CSS 来布局图片
    CSS3 用户界面:用户界面特性来调整元素尺寸,框尺寸和外边框
    CSS3 多列:如何将文本内容设计成像报纸一样的多列布局?
    mac Pycharm:如何使用anaconda安装jieba
    pycharm如何安装jieba词频统计器?
    CSS3 动画:使元素从一种样式逐渐变化为另一种样式的效果
    CSS3 过渡:用鼠标移过逐渐改变它原有样式
    CSS3 3D 转换:使用 3D 转换来对元素进行格式化
    CSS3 2D 转换:对元素进行移动、缩放、转动、拉长或拉伸
  • 原文地址:https://www.cnblogs.com/micro-chen/p/5849588.html
Copyright © 2011-2022 走看看