久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

[譯]Introducing ASP.NET vNext and MVC 6

 昵稱10504424 2014-05-28

 Part of the ASP.NET vNext initiative, ASP.NET MVC 6 represents a fundamental change to how Microsoft constructs and deploys web frameworks. The goal is to create a host agnostic framework that eliminates the dependencies on the legacy System.Web infrastructure.

  ASP.NET MVC 6作為ASP.NET vNext解決方案的一部分,,體現(xiàn)了一個(gè)根本性的改變——微軟如何構(gòu)建和部署web應(yīng)用,。它的目標(biāo)是:創(chuàng)建一個(gè)宿主無關(guān)的框架,,以便消除對(duì)傳統(tǒng)的System.Web程序集的依賴,。

 

  Microsoft feels that System.Web needs to be removed because it is actually quite expensive. A typical HttpContext object graph can consume 30K of memory per request. When working with small JSON-style requests this represents a disproportionately high cost. With MVC 6 new design, the pre-request overhead drops to roughly 2K.

  微軟認(rèn)為System.Web需要被移除,因?yàn)樗趯?shí)際使用中相當(dāng)昂貴,。在每次請(qǐng)求中,,一個(gè)典型的HttpContext對(duì)象圖會(huì)占用30K內(nèi)存。這與使用JSON通信相比,,造成不成比例的高成本,。MVC 6力求將“預(yù)請(qǐng)求”的開銷下降到大約2K。

 

  Included in MVC 6 is Web API and Web Pages, allowing Microsoft to remove a lot of the overlap between the three frameworks. One result of this change means that MVC will be self-hosting just like Web API 2 and SignalR 2.

  MVC6中包含Web API,,Web Pages,,微軟移除了框架中重復(fù)的部分,這種變化意味著MVC 6將是自托管的,,如同Web API 2和SignalR 2,。

 

  In order to make deployment easier and more reliable, “vNext will support true side-by-side deployment.” Rather than being installed in the GAC, each MVC library needed for a given web site will be referenced like a normal developer-created DLL. “That means you can update your app without affecting other applications on the same server.”

   為了使部署更容易和可靠,vNext將支持真正的并行部署,。使用MVC 6構(gòu)建網(wǎng)站時(shí),,站點(diǎn)依賴的程序集不會(huì)安裝在GAC中而是和開發(fā)者創(chuàng)建的DLL類似。這意味著你可以更新你的應(yīng)用,,而不會(huì)影響同一服務(wù)器上的其他應(yīng)用,。

 

Pay As You Go (現(xiàn)收現(xiàn)付)

  MVC 6 is built on a “pay as you go” philosophy. Each feature that you wish to use has to be explicitly turned on in the application startup routine. Even serving up static files requires calling IBuilder.UseStaticFiles.

  MVC 6的設(shè)計(jì)體現(xiàn)了“現(xiàn)收現(xiàn)付”理念。你希望使用的每一個(gè)功能都會(huì)在應(yīng)用啟動(dòng)程序中開啟,。甚至提供靜態(tài)文件需要調(diào)IBuilder.UseStaticFiles,。

 

  The way this works is that each website needs to have a class named Startup and this class must have a method called “void Configure (IBuilder app)”. Inside this method you can call functions such as “app.UseServices” to enable features such as MVC.

  其工作原理是:每個(gè)站點(diǎn)都需要有一個(gè)名為Startup的類,這個(gè)類有一個(gè)方法“void Configure (IBuilder app)”方法,。在該方法中可以調(diào)用你需要的功能方法,,如“app.UseServices”,,以便啟動(dòng)某些特性如MVC。

 

  Routing is also setup in the Configuration method. MVC 6 routes are similar, but not identical, to MVC 5 routes. For example, a question mark can be added to a fragment to make it optional in MVC 6. In MVC 5 you would use the UrlParameter.Optional value for the same effect.

  路由也在配置方法中進(jìn)行設(shè)置,。 與MVC 5的路由相比,,MVC 6有些相似,但不完全相同,。例如,,在MVC 6中可以通過追加問號(hào)表示可選參數(shù),而在MVC 5中,,需要將其默認(rèn)值定義為UrlParameter.Optional來達(dá)到相同的效果,。

 

Azure and PowerShell Based Deployments (Azure部署和基于PowerShell的部署)

  Microsoft is still heavily pushing Azure as the standard way to deploy websites. But they have realized that developers are leery of publishing websites directly from Visual Studio. So instead they will generate PowerShell deployment scripts by default. These can then be edited inside Visual Studio, which now has basic tooling support for PowerShell.

  微軟仍在很大程度上推動(dòng)讓Azure部署成為網(wǎng)站部署的標(biāo)準(zhǔn)方式。但他們已經(jīng)意識(shí)到,,開發(fā)者們都不愿意直接從Visual Studio發(fā)布網(wǎng)站,。所以,作為替代,,默認(rèn)情況下會(huì)生成PowerShell腳本,。在新版Visual Studio中,已經(jīng)包含了一些PowerShell的基本工具,,以便用戶能夠在Visual Studio里編輯那些生成的腳本,。

 

The Build Process Doesn’t Build (在生成過程中不會(huì)構(gòu)建程序集)

  In ASP.NET vNext the build process does not actually build anything. No binaries are generated, it merely runs the type checker to ensure you don’t have any errors or warnings that need to be addressed. Instead the code is compiled on the fly in an as-needed basis, much like we already see with ASP.NET Web Pages. This allows for faster iterations, especially over large websites.

  實(shí)際上,ASP.NET vNext在生成過程中并沒有構(gòu)建任何東西,。不生成任何二進(jìn)制文件,,它只是運(yùn)行類型檢查,以發(fā)現(xiàn)你代碼的編譯時(shí)錯(cuò)誤和警告,。作為代替,,代碼會(huì)在其被需要時(shí),快速地被編譯,,這種按需編譯代碼的方式,,很像我們所熟知的ASP.NET中的動(dòng)態(tài)編譯機(jī)制。這允許更快的迭代,,尤其是在大型網(wǎng)站中,。

 

  If you want actual binaries to be deployed on a server you need to run the package and publish command. Eventually this will offer several options from source code only, which will continue to compile on the fly, all the way up to natively compiled. The latter should have better performance, but could entail a much longer build process.

  如果你想將二進(jìn)制的程序集部署在服務(wù)器上,需要使用發(fā)布功能,。這種方式將有更好的表現(xiàn),,但也意味著更長(zhǎng)的構(gòu)建時(shí)間。

 

Many APIs Will Be Moved or Removed (一些API將被移動(dòng)和刪除)

  As mentioned before, they are reducing the size of HttpContext from roughly 30K per request to 2K per request. This isn’t free, the cost of that is a significantly reduced set of methods on that object and its children. And by the time they are done it is probably not going to be the only API trimmed down in size.

  正如前面提到的,,既減少HttpContext的大小從大約每個(gè)請(qǐng)求30K到2K,。這不是免費(fèi)得來的,其代價(jià)是減少該對(duì)象及其子對(duì)象中的方法,。當(dāng)他們完成時(shí),,可能改變的不僅僅是大小。

 

  In order to make this transition less painful, they intend to develop an FxCop like tool that will detect when legacy APIs calls are being made. While it won’t be able to automatically rewrite your code, it can at least tell you what needs to be changed before migrating to ASP.NET vNext and MVC 6.

  為了使技術(shù)過渡更為平滑,,微軟打算開發(fā)一個(gè)類似FxCop的工具,,用于檢測(cè)遺留的API調(diào)用。雖然它不能自動(dòng)重寫你的代碼,,它至少可以告訴你需要遷移到ASP.NET vNext和MVC 6前要改變什么,。

 

  Sometimes the change will just involve calling a different method from an optional package or library. Other times the code will need to be significantly rewritten. Since the product is still in alpha a complete list of these changes is not yet available.

  有時(shí),變化僅僅是調(diào)用新的程序集或包中的方法,。而其它時(shí)候,,代碼可能需要大量重構(gòu)。由于該產(chǎn)品仍然處于alpha階段,,這些變化的具體內(nèi)容尚不可知,。

 

Full Framework vs Cloud Optimized Framework (完整的Framework VS 云優(yōu)化的Framework)

  The above warnings come into play because they are removing their dependency on System.Web but otherwise stay on the full .NET Framework. If you take the next step and go with what they are calling the “Cloud Optimized Framework” then you lose access to even more APIs. In the Channel 9 Q&A session they mentioned System.Drawing as an example of what you can’t use.

  上述警告開始發(fā)揮作用,即使消除對(duì)System.Web的依賴,,但仍然保持著對(duì).NET Framework的依賴,。如果你采取更進(jìn)一步的行動(dòng),依賴“云優(yōu)化的Framework”,,那么,,你將無法使用很多.NET Framework的API方法,例如在Channel 9 Q&A session中提到的System.Drawing,。

 

  The advantage of using the Cloud Optimized Framework is that you can include a copy of the Core (or Mono) CLR with your website. You no longer have to upgrade .NET on the entire machine for the sake of one website. You can even have different versions of the CLR for different websites running side by side.

  利用云優(yōu)化的Framework的好處是,,你的站點(diǎn)可以包括Core CLR或Mono的副本。你不必再為某個(gè)網(wǎng)站而升級(jí)設(shè)備軟件,,你甚至可以有不同版本的CLR并行地運(yùn)行不同的站點(diǎn),。

 

  The Core CLR is also supposed to be tuned with a “high resource-efficient optimization”. Exactly what that means has not yet been revealed.

  Core CLR也應(yīng)該被“資源優(yōu)化”過。但具體內(nèi)容,,尚未透露,。

 

Libraries vs Packages (庫 vs 包)

  Under the .NET vNext model, projects don’t reference individual libraries anymore. Instead they reference NuGet Packages. As you probably know, packages can contain multiple versions of a library divided by target platform. ASP.NET vNext can leverage this to decide at runtime whether to load the Full .NET, Mono, or Core CLR version of a given library.

  在vNext中,項(xiàng)目不引用單個(gè)類庫,,而是引用NuGet包,。正如你可能知道的,包可以包含同一類庫的多個(gè)版本,。ASP.NET vNext可以利用這個(gè)來決定在運(yùn)行時(shí)是否加載某個(gè)類庫的Full .NET,、Mono或Core CLR版本。

 

  If this doesn’t sound palatable to you, there will also the option to use Portable Class Libraries. Though it isn’t ready yet, they plan on creating a PCL profile for the Cloud Optimized Framework.

  如果這聽起來不吸引你,,你也可以使用“可移植類庫”,。盡管它還沒有準(zhǔn)備好,微軟計(jì)劃為云優(yōu)化的Framework創(chuàng)建PCL切面,。

 

Mono is a Supported Platform (支持Mono)

  In the past the support story for Mono was essentially “we hope it runs, but if it doesn’t then you need to talk to Xamarin”. Now Microsoft is billing Mono as the official cross-platform CLR for ASP.NET vNext. To that effect they are actively working with the Mono teams to ensure it has everything they need and will include Mono in their Continuous Integration testing.

  過去,,對(duì)于Mono,,我們常常聽到:“我們希望它運(yùn)行的很好,但如果它不那么盡如人意,,你就只能求助于Xamarin了”?,F(xiàn)在,為了實(shí)現(xiàn)ASP.NET vNext的跨平臺(tái)性,,微軟官方正式發(fā)布支持Mono的CLR,。微軟將積極與Mono團(tuán)隊(duì)合作,以確保集成測(cè)試的覆蓋率,。

 

  That said, Microsoft isn’t offering official support for Mono via their paid support channels. They are only promising to maintain compatibility and that if a CI test fails they will work with the Mono teams to fix it.

  此外,,微軟沒有在其支付渠道為Mono提供支持。微軟只許諾維持兼容性,,如果持續(xù)集成測(cè)試出現(xiàn)缺陷,,他們將與Mono開發(fā)團(tuán)隊(duì)一起解決它。

 

Cross Platform Development (跨平臺(tái)開發(fā))

  Not only is Microsoft planning for cross-platform deployment, they are also enabling cross-platform development. Batch files for the major platforms such as OS X and Linux will be provided so that you can package and deploy ASP.NET vNext projects without needing Windows and Visual Studio.

  微軟不僅在計(jì)劃跨平臺(tái)開發(fā),,他們也在推動(dòng)跨平臺(tái)開發(fā),。微軟會(huì)為諸如OS X和Linux等主要平臺(tái)提供批處理文件,以便用戶可以在不借助Windows平臺(tái)和Visual Studio的情況下,,打包和部署ASP.NET vNext項(xiàng)目,。

 

  Part of this is the KPM or the “Katana Packaged Modules”, which were inspired by Node Packaged Modules. Katana was a research project for modularizing ASP.NET MVC for use on Owin. KPM will use the NuGet repository on the backend.

  其中之一就是KPM,KPM是受Node Packaged Modules啟發(fā)得來的,。Katana是一個(gè)研發(fā)項(xiàng)目,,其目標(biāo)借助Owin讓ASP.NET MVC模塊化。KPM的后臺(tái)將使用NuGet,。

 

Trying it Out (嘗試一下)

  The preview version of the ASP.NET vNext binaries are available now. Visual Studio support is expected to be available in three to four weeks.
  目前已經(jīng)發(fā)布了ASP.NET vNext binaries的預(yù)覽版,。預(yù)計(jì)會(huì)在三至周后使Visual Studio對(duì)其支持。

作者:MeteorSeed

感謝您閱讀本文,,如果您覺得有所收獲,,麻煩點(diǎn)一下右邊的“推薦”,您的支持是對(duì)我最大的鼓勵(lì)...

轉(zhuǎn)載請(qǐng)注明出處,。

分類: C#, 翻譯
標(biāo)簽: 翻譯

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多