收藏 分销(赏)

ASPNET-5外文文献及翻译.docx

上传人:仙人****88 文档编号:8367767 上传时间:2025-02-11 格式:DOCX 页数:17 大小:167.55KB 下载积分:10 金币
下载 相关 举报
ASPNET-5外文文献及翻译.docx_第1页
第1页 / 共17页
ASPNET-5外文文献及翻译.docx_第2页
第2页 / 共17页


点击查看更多>>
资源描述
ASP.NET 5 : Introducing the ASP.NET 5 Preview Daniel Roth | Special connect(); issue 2014 ASP.NET shipped as part of the Microsoft .NET Framework 1.0, released in 2002 along with Visual Studio 2002. It was an evolution of Active Server Pages (ASP) that brought object-oriented design, the .NET Base Class Libraries (BCLs), better performance and much more. ASP.NET was designed to make it easy for developers used to writing desktop applications to build Web applications with ASP.NET Web Forms. As the Web evolved, new frameworks were added to ASP.NET: MVC in 2008, Web Pages in 2010, and Web API and SignalR in 2012. Each of these new frameworks built on top of the base from ASP.NET 1.0. With ASP.NET 5, ASP.NET is being reimagined just like ASP was reimagined to ASP.NET in 2002. This reimagining brings many new features: · Full side-by-side support: ASP.NET 5 applications can now be installed on a machine without affecting any other applications on the machine. · Cross-platform support: ASP.NET 5 runs and is supported on Windows, Mac and Linux. · Cloud-ready: Features such as diagnostics, session state, cache and configuration are designed to work locally and in the cloud. · Faster development: The build step is removed; just save source files and refresh the browser and compilation happens automatically. · MVC, Web Pages and Web API: These are all merged together, simplifying the number of concepts. · Flexible hosting: You can now host your entire ASP.NET 5 application on IIS or in your own process. Getting Started with ASP.NET 5 Preview In this article, I’ll give an overview of the new experiences the ASP.NET development team—of which I’m a part—has created for ASP.NET 5 and Visual Studio 2015 Preview. For general help with building and running ASP.NET 5 applications, visit  where you can find step-by-step guides and additional documentation. In addition, we also post updates regularly to  To get started, download and install Visual Studio 2015 Preview. Overview of the ASP.NET 5 Runtime ASP.NET 5 has been rebuilt from the ground up to support building modern Web applications and services. It’s open source, cross-platform and works both on-premises and in the cloud. ASP.NET 5 is currently in Preview and under active development on GitHub ( I’ll provide an overview of what’s new in the ASP.NET 5 Preview along with pointers to where you can learn more. Flexible, Cross-Platform Runtime At its foundation, ASP.NET 5 is based on a new flexible runtime host. It provides the flexibility to run your application on one of three different runtimes: 1. Microsoft .NET Framework: You can run your ASP.NET 5 applications on the existing .NET Framework. This gives you the greatest level of compatibility for existing binaries. 2. .NET Core: A refactored version of the .NET Framework that ships as a set of NuGet packages that you can include with your app. With .NET Core, you get support for true side-by-side versioning and the freedom to use the latest .NET features on your existing infrastructure. Note that not all APIs are available yet on .NET Core, and existing binaries generally need to be recompiled to run on .NET Core. 3. Mono: The Mono CLR enables you to develop and run ASP.NET 5 apps on a Mac or Linux device. For more information, see the blog post, “Develop ASP.NET vNext Applications on a Mac,” atbit.ly/1AdChNZ. Regardless of which CLR is used, ASP.NET 5 leverages a common infrastructure for hosting the CLR and provides various services to the application. This infrastructure is called the K Runtime Environment (KRE). While it’s somewhat of a mystery where the “K” in KRE comes from (a tribute to the Katana Project? K for Krazy Kool?), the KRE provides everything you need to host and run your app. A New HTTP Pipeline ASP.NET 5 introduces a new modular HTTP request pipeline that can be hosted on the server of your choice. You can host your ASP.NET 5 applications on IIS, on any Open Web Interface for .NET (OWIN)-based server or in your own process. Because you get to pick exactly what middleware runs in the pipeline for your app, you can run with as little or as much functionality as you need and take advantage of bare-metal performance. ASP.NET 5 includes middleware for security, request routing, diagnostics and custom middleware of your own design. For example, here’s a simple middleware implementation for handling of the X-HTTP-Method-Override header: app.Use((context, next) => {   var value = context.Request.Headers["X-HTTP-Method-Override"];   if (!string.IsNullOrEmpty(value))   {     context.Request.Method = value;   }   return next(); }); ASP.NET 5 uses an HTTP pipeline model similar in many ways to the OWIN-based model introduced with Project Katana, but with several notable improvements. Like Katana, ASP.NET 5 supports OWIN, but simplifies development by including a lightweight and easy-to-use HttpContext abstraction. There’s a Package for That Package managers have changed the way developers think about installing, updating and managing dependencies. In ASP.NET 5, all your dependencies are represented as packages. NuGet packages are the unit of reference. ASP.NET 5 makes it easy to build, install and use packages from package feeds and also to work with community packages on the node package manager (NPM) and Bower. ASP.NET 5 introduces a simple JSON format (project.json) for managing NuGet package dependencies and for providing cross-platform build infrastructure. An example project.json file is shown in Figure 1 (a more detailed explanation of each of the supported properties can be found on GitHub atbit.ly/1AIOhK3). Figure 1 An Example project.json File {   "webroot": "wwwroot",   "version": "1.0.0-*",   "exclude": [     "wwwroot"   ],   "packExclude": [     "**.kproj",     "**.user",     "**.vspscc"   ],   "dependencies": {     "Microsoft.AspNet.Server.IIS": "1.0.0-beta1",     "Microsoft.AspNet.Diagnostics": "1.0.0-beta1"   },   "frameworks" : {     "aspnet50" : { },     "aspnetcore50" : { }   } } The Best of C# Design-time and run-time compilation for ASP.NET 5 applications are handled using the managed .NET Compiler Platform (code-named “Roslyn”). This means you get to take advantage of the latest C# language features while leveraging in-memory compilation to avoid unnecessary disk I/O. ASP.NET 5 projects are based on a new project system that dynamically compiles your application on-the-fly as you’re coding so you can avoid the interruption of a specific build step. This gives you the power of .NET and C# with the agility and feel of an interpreted language. Built-in Dependency Injection All ASP.NET 5 applications have access to a common dependency injection (DI) service that helps simplify composition and testing. All the ASP.NET frameworks built on ASP.NET 5 (MVC, Web API, SignalR and Identity) leverage this common DI service. While ASP.NET 5 comes with a minimalistic Inversion of Control (IoC) container to bootstrap the system, you can easily replace that built-in IoC container with your container of choice. Familiar Web Frameworks ASP.NET 5 includes frameworks for building Web apps and services such as MVC, Web API, Web Pages (coming in a future release), SignalR and Identity. Each of these frameworks has been ported to work on the new HTTP request pipeline and has been built to support running on the .NET Framework, .NET Core or cross-platform. Today, the existing implementations of MVC, Web API and Web Pages share many concepts and duplicate abstractions, but share very little in the way of actual implementation. As part of porting these frameworks to ASP.NET 5, Microsoft decided to take a fresh look at combining these frameworks into a single unified Web stack. ASP.NET MVC 6 takes the best of MVC, Web API and Web Pages and combines it into a single framework for building Web UI and Web APIs. This means from a single controller you can just as easily render a view as return formatted data based on content negotiation. In addition to unification, ASP.NET MVC 6 introduces a host of new features: · Built-in DI support · Ability to create controllers from any class—no base class required · Action-based request dispatching · View Components—a simple replacement for child actions · Routing improvements, including simplified attribute routing · Async views with flush points · Ability to inject servers and helpers into views using @inject · ViewStart inheritance · Tag helpers You can find more information and samples at  Web Forms isn’t available on ASP.NET 5, but is still fully supported on the .NET Framework. There are a number of important new features coming to Web Forms in the upcoming version of the .NET Framework, including support for HTTP 2.0, async model binding and a Roslyn-based CodeDom provider. We’re also working on various features reminiscent of Web Forms in MVC 6, such as tag helpers and other Razor improvements. Entity Framework Data is a key part of many applications and Entity Framework (EF) is a popular data access choice for ASP.NET developers. While EF7 isn’t specific to ASP.NET, this new version of EF plays an integral role in ASP.NET 5. EF7 Enables New Platforms EF is widely used in client and server applications that target the full .NET Framework. A key focus of EF7 is to enable EF to be used on the remaining platforms where .NET development is common. These include ASP.NET 5, Windows Store and Windows Phone applications, as well as .NET-based Mac and Linux applications. For Windows Phone and Windows Store applications, the initial goal is to provide local data access using EF. SQLite is the most common database of choice on devices and will be the primary store for local data on devices with EF7. The full provider model will be available, though, so other data stores can be supported also. EF7 Enables New Data Stores While parts of EF are clearly tied to relational data stores, much of the functionality that EF provides is also applicable to many non-relational data stores. Examples of such functionality include change tracking, LINQ and unit of work. EF7 will enable providers that target non-relational data stores, such as Microsoft Azure Table Storage. We’re explicitly not trying to build an abstraction layer that hides the type of data store you’re targeting. The common patterns/components that apply to most data stores will be handled by the core framework. Things specific to particular types of data stores will be available as provider-specific extensions. For example, the concept of a model builder that allows you to configure your model will be part of the core framework. However, the ability to configure things such as cascade delete on a foreign key constraint will be included as extensions in the relational database provider. EF7 Is Lightweight and Extensible EF7 will be a lightweight and extensible version that pulls forward some commonly used features. In addition, we’ll be able to include some commonly requested features that would’ve been difficult to implement in the EF6 code base, but which can be included from the start in EF7. The team will be keeping the same patterns and concepts you’re used to in EF, except where there’s a compelling reason to change something. You’ll see the same DbContext/DbSet-based API, but it will be built over building block components that are easy to replace or extend as needed—the same pattern used for some of the isolated components added in recent EF releases. More Information on EF7 For more information on EF7, visit the “What Is EF7 All About” GitHub page at aka.ms/AboutEF7. The page includes design information, links to blog posts and instructions for trying out EF7. ASP.NET Command-Line Tools One of the core ASP.NET 5 tenets was to provide a command-line experience before we built the tooling experience. This means that almost all tasks you need to do with an ASP.NET 5 application can be done from the command line. The main reason for this is to ensure a viable option for using ASP.NET 5 without Visual Studio for those using Mac or Linux machines. KVM The first tool you need to get the full command-line experience for ASP.NET 5 is the K Version Manager (KVM). The KVM command-line tool can download new versions of the KRE and let you switch between them. KRE contains other command-line tools that you might use. How KVM is implemented, and how to get it, depends on the OS. You can download and install KVM for your platform by running the appropriate command from  Once you have KVM, you should be able to open a command prompt and run the kvm command. If you run “kvm list,” you’ll see the list of all KRE versions on your machine, as shown in Figure 2.   Figure 2 Running “kvm list” at the Command Line to Get a List of KRE Versions on Your Machine If there are no entries in your list, there are no versions of KRE in your user profile. To fix this, you can run the command “kvm upgrade.” This command will determine the latest version of the KRE available, download it and modify your PATH environment variable so you can use the other command-line tools in the KRE itself. You can use “kvm install <version/latest>” to install a particular version without making it the default. Use the –r switch to indicate whether you want the .NET Core or .NET Framework version of the KRE and the –x86 and –amd64 switches to download the 32- or 64-bit flavors of the KRE. The runtime and bitness switches can be supplied to either install or upgrade. Once you’ve called “kvm upgrade,” you’ll be able to use the K and KPM commands. K can be used to run applications, while KPM is used to manage packages. How does KVM work? At its heart, KVM is just a convenient way to manipulate your PATH. When you use “KVM use <version>,” all it does is change your PATH to the bin folder of the KRE version you specified is on your PATH. By default the KRE is installed by copying and extracting the KRE .zip file into %USERPROFILE%\.kre\packages, so when you type “KVM use 1.0.0-beta1,” KVM will make sure that %USERPROFILE%\.kre\packages\KRE-CLR-x86.1.0.0-beta1\bin is on your PATH. KPM The next tool you’ll want to use is the KRE Package Manager (KPM). The KPM performs two main functions, with a few lesser features: 1.You can run “kpm restore” in a folder with a project.json file to download all the packages your application needs. 2.It provides the pack command, “kpm pack,” which will take your application and generate a self-contained, runnable image of your application. Here, image means a folder structure that’s designed to be copied to the server and run. It will include all the packages your application requires, as well as, optionally, the KRE on which you want to run the application. The restore command can be run in a folder that contains a project.json file. It will examine th
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 教育专区 > 小学其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服