zoukankan      html  css  js  c++  java
  • .net 4.5的新特性

    .Net For Metro style app

    Metro style app给我的感觉是为了开发具有很好用户体验的应用程序,而且是基于桌面的应用程序。 

    相关解释:http://msdn.microsoft.com/zh-tw/library/windows/apps/hh464920

    Asynchronous File Operations

    In the .NET Framework 4.5 Developer Preview, new asynchronous features were added to the C# and Visual Basic languages. These features add a task-based model for performing asynchronous operations. To use this new model, use the asynchronous methods in the I/O classes. 

    WEB

    ASP.NET 4.5 Developer Preview includes the following new features:

    • Support for new HTML5 form types.

    • Support for model binders in Web Forms. These let you bind data controls directly to data-access methods, and automatically convert user input to and from .NET Framework data types.

    • Support for unobtrusive JavaScript in client-side validation scripts.

    • Improved handling of client script through bundling and minification for improved page performance.

    • Integrated encoding routines from the AntiXSS library (previously an external library) to protect from cross-site scripting attacks.

    • Support for WebSockets protocol.

      WebSocket protocol 是HTML5一种新的协议(protocol)。它是实现了浏览器与服务器全双工通信(full-duplex)。

      现在,很多网站为了实现即时通讯(real-time),所用的技术都是轮询(polling)。轮询是在特定的的时间间隔(time interval)(如每1秒),由浏览器对服务器发出HTTP request,然后由服务器返回最新的数据给客服端的浏览器。这种传统的HTTP request d的模式带来很明显的缺点 – 浏览器需要不断的向服务器发出请求(request),然而HTTP request 的header是非常长的,里面包含的数据可能只是一个很小的值,这样会占用很多的带宽。

      而最比较新的技术去做轮询的效果是Comet – 用了AJAX。但这种技术虽然可达到全双工通信,但依然需要发出请求(reuqest)。

      在 WebSocket API,浏览器和服务器只需要要做一个握手的动作,然后,浏览器和服务器之间就形成了一条快速通道。两者之间就直接可以数据互相传送。在此WebSocket 协议中,为我们实现即使服务带来了两大好处:

      1. Header

      互相沟通的Header是很小的-大概只有 2 Bytes

      2. Server Push

      服务器可以主动传送数据给客户端

    • Support for reading and writing HTTP requests and responses asynchronously.

    • Support for asynchronous modules and handlers.

    • Support for content distribution network (CDN) fallback in the ScriptManager control.

      A content delivery network is an environment containing a network of systems. The systems will contain objects, files etc...Once a client from UK connects to a CDN, the system near to the UK location will provide data. The same thing will happen for a client from Japan, i.e.system near to Japan will provide data. So this will improve the network bandwidth as clients are getting data from different systems rather than a centralized mechanism. How this can be used in a developer perspective? Yes, we have asp.net ajax with support of CDN.
      By taking advantage of the Microsoft Ajax CDN, you can significantly improve the performance of your Ajax applications. The contents of the Microsoft Ajax CDN are cached on servers located around the world. In addition, the Microsoft Ajax CDN enables browsers to reuse cached JavaScript files for Web sites that are located in different domains. In VS2010 we have an attribute for ScriptManager named "EnableCdn="true". This will make the script libraries to be loaded from CDN. Follow this link for more information http://www.asp.net/ajaxlibrary/cdn.ashx 


      CDN的实现,对技术上的要求是很高的,它所采用的关键技术包括:负载均衡技术、动态内容路由、高速缓存机制、动态内容分发与复制、网络安全机制等。

      AD:

      CDN的实现,对技术上的要求是很高的,它所采用的关键技术包括:负载均衡技术、动态内容路由、高速缓存机制、动态内容分发与复制、网络安全机制等。

      动态内容路由:
      当用户访问加入CDN服务的网站时,域名解析请求将最终由重定向DNS负责处理。它通过一组预先定义好的策略(如内容类型、地理区域、网络负载状况等),将当时最接近用户的节点地址提供给用户,使用户得到快速的服务。同时,它还与分布在不同地点的所有CDN节点保持通信,搜集各节点的健康状态,确保不将用户的请求分配到任何一个已经不可用的节点上。它还具有在网络拥塞和失效情况下,自适应调整路由的能力。

      高速缓存机制:
      Web 缓存服务通过几种方式来改善用户的响应时间。如代理缓存服务、透明代理缓存服务、使用重定向服务的透明代理缓存服务等。通过 Web 缓存服务,用户访问网页时可以将 WAN或 Internet的流量降至最低。这意味着用户可以获得更快的响应,而且企业或 ISP 也会因为通信成本的降低而受益。

      动态内容分发与复制:
      网站访问响应速度取决于许多因素,如网络的带宽是否有瓶颈、传输途中的路由是否有阻塞和延迟、网站服务器的处理能力、访问距离等。 多数情况下,网站响应速度和访问者与网站服务器之间的距离有密切的关系。尽管目前电信运营商不断地扩充带宽容量,但是如果访问者和网站之间的距离太远的话,它们之间的通信一样需要经过重重的路由转发和处理,网络延时不可避免。一个有效的方法就是利用内容分发与复制机制,将占网站主体的大部分静态网页、图像和流媒体数据分发复制到各地的加速节点上。内容分发网络可以采用智能路由和流量管理技术,及时发现离访问者最近的加速节点,并将访问者的请求转发到该加速节点,由该加速节点提供内容服务。利用内容分发与复制机制,托管客户不需要改动原来的网站结构,只需修改少量的DNS配置,就可以加速网络的响应速度。

      CDN面临的问题

      CDN在国外也可以说是一个新生事物,美国的一些IDC也是正在转为CDN服务提供商。正因为如此,CDN面临的最大困难是对它的不了解乃至被误导。CDN往往被理解为一个锦上添花而非雪中送炭的服务。实际上,对于很多应用来说,CDN可以说是一个必要的服务,例如流媒体服务、ASP服务等等。再比如,如果某个在各地都有分支机构的企业开展CRM项目,其数据流量可能不大,但响应速度要求快,否则数据库内容可能会出现错乱。在这种情况下,CDN也是能派上用场的。在技术上,CDN由于对光纤、带宽、网络设备以及运行维护和工程人员的要求比较高,所以实施起来有一定的难度。

    For more information about these features, see What’s New for ASP.NET 4.5 and Web Development in Visual Studio 11 Developer Preview. 

    NetWorking

    The .NET Framework 4.5 Developer Preview provides a new programming interface for HTTP applications. For more information, see the new System.Net.Http andSystem.Net.Http.Headers namespaces.

    Also, the following networking improvements are included in the System.NetSystem.Net.Mail, and related namespaces:

    • Improved internationalization and IPv6 support.

    • RFC-compliant URI support.

    • Support for Internationalized Domain Name (IDN) parsing.

    • Support for Email Address Internationalization (EAI).

    WF

    Several new features have been added to Windows Workflow Foundation (WF) in the .NET Framework 4.5 Developer Preview. These new features include:

    • Ability to create state machine workflows.

    • Enhanced Workflow Designer features such as the following:

      • Enhanced workflow search capabilities in Visual Studio, including Quick Find and Find in Files.

      • Ability to automatically create a Sequence activity when a second child activity is added to a container activity, and to include both activities in the Sequence activity.

      • Panning support, which enables the visible portion of a workflow to be changed without using the scroll bars.

      • A new Document Outline view that shows the components of a workflow in a tree-style outline view and lets you select a component in the Document Outlineview.

      • Ability to add annotations to activities.

      • Ability to define and consume activity delegates by using the workflow designer.

      • Auto-connect and auto-insert for activities and transitions in state machine and flowchart workflows.

    • Storage of the view state information for a workflow in a single element in the XAML file, so you can easily locate and edit the view state information.

    • A NoPersistScope container activity to prevent child activities from persisting.

    • Support for C# expressions:

      • Workflow projects that use Visual Basic will use Visual Basic expressions, and C# workflow projects will use C# expressions.

      • C# workflow projects that were created in Visual Studio 2010 and that have Visual Basic expressions are compatible with C# workflow projects that use C# expressions.

    • Versioning enhancements:

      • The new WorkflowIdentity class, which provides a mapping between a persisted workflow instance and its workflow definition.

      • Side-by-side execution of multiple workflow versions in the same host, including WorkflowServiceHost.

      • In Dynamic Update, the ability to modify the definition of a persisted workflow instance.

    • Contract-first workflow service development, which provides support for automatically generating activities to match an existing service contract.

    For more information, see What's New in Windows Workflow Foundation. 

    See Also

    Concepts

    Other Resources

    原文地址:http://msdn.microsoft.com/zh-cn/library/ms171868(v=vs.110).aspx 

  • 相关阅读:
    千万级规模高性能、高并发的网络架构经验分享
    CPU高问题排查
    Worker+MQ解惑
    HashMap解惑
    配置时间同步时,遇到同步无法成功的解决方法
    Django基础—— 1.WEB框架介绍
    html5兼容性问题
    jQuery基础——节点操作
    jQuery基础——基本操作
    jQuery基础——选择器
  • 原文地址:https://www.cnblogs.com/malaikuangren/p/2528145.html
Copyright © 2011-2022 走看看