[ASP.NET] VS14 and ASP.NET VNext

[ASP.NET] VS14 and ASP.NET VNext


Microsoft today released a version number CPT1 version of Visual Studio 14's (future versions of the names are not finalized, currently referred to as the VS14, is expected in 2015, will launch the official version, according to official documents), and has been available for download (VS14), this version currently we only try to provide feedback and suggestions to the Visual Stuiod team temporarily in English only, and is not recommended to install on official development machine (unless you are prepared to install XD), the compatibility is not guaranteed, if You want early adopters, then you can try to get hold of VM, in addition if you are eligible MSDN subscription, you can also directly on Azure to open a WIN VM 8 mounted directly also possible.

image

After installation is complete, the project can be found on the Web at TechEd 2014 North America announced ASP.NET VNext version of the project. About VNEXT features, refer MVP Xiaozhu Blog article ([ASP.NET] [vNext] ASP.NET vNext @ 2014), it simply VNEXT Cloud is the starting point for core optimization done, compile and execute We will have better performance.

image

Because ASP.NET vNext is no longer necessarily dependent on IIS to perform, and therefore no longer see Web.config file in the Web project, instead the project.json file, and this file dependencies set a record in project construction and assembly home setting. Compare Empty Web Application and Web Application.

image

image

Project.json also provides IntelliSense to assist developers can add a reference, for example, I want to join jQuery, as long as the input on key word jQ you can see a list of data listed.

image

image

After saving project.json file can be found automatically through NUGET installation.

image

另外在项目里还会有个 startup.cs ,vNext 项目在默认启动上会找到Startup class,并执行Configure 方法,从 Web Application里可以看到在Configure 方法里加入了包含 MVC路由、DB连线字符串、EF ......等。

using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Security;
using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Security.Cookies;
using Microsoft.Data.Entity;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using WebApplication3.Models;
 
namespace WebApplication3
{
    public class Startup
    {
        public void Configure(IBuilder app)
        {
            // Enable Browser Link support
            app.UseBrowserLink();
 
            // Setup configuration sources
            var configuration = new Configuration();
            configuration.AddJsonFile("config.json");
            configuration.AddEnvironmentVariables();
 
            // Set up application services
            app.UseServices(services =>
            {
                // Add EF services to the services container
                services.AddEntityFramework()
                    .AddSqlServer();
 
                // Configure DbContext
                services.SetupOptions
 
 
  
  (options =>
 
 
                {
                    options.UseSqlServer(configuration.Get("Data:DefaultConnection:ConnectionString"));
                });
                
                // Add Identity services to the services container
                services.AddIdentity
 
 
  
  ()
 
 
                    .AddEntityFramework
 
 
  
  ()
 
 
                    .AddHttpSignIn();
 
                // Add MVC services to the services container
                services.AddMvc();
            });
 
            // Add static files to the request pipeline
            app.UseStaticFiles();
 
            // Add cookie-based authentication to the request pipeline
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
            });
 
            // Add MVC to the request pipeline
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default", 
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "Home", action = "Index" });
 
                routes.MapRoute(
                    name: "api",
                    template: "{controller}/{id?}");
            });
        }
    }
}


Then try to publish, in the past will find in the bin folder will produce a bunch of dll are gone, replaced by a AspNet.Loader.dll. In ASP.NET vNEXT is the use of dynamic compilation, these actions will be completed in memory, faster.

image

In ASP.NET vNEXT items you'll find a lot of components have been split up, as in the past is not a large bag, which components need to join the project in accordance with demand, which will have to use the past look more bulky components will dwarf many weight-loss, References to previous GAC and the way also turn out to be side by side manner, each project will not interfere with each other.

These are some of the ideas generally rough demo VS14 and ASP.NET vNEXT, interested friends can try Hello.

Ref : http://www.asp.net/vnext/overview/aspnet-vnext/getting-started-with-aspnet-vnext-and-visual-studio

If this article helpful, you are welcome to repost, but please raise - posted origin and provenance, and attach Benpian hyperlinks, thanks for your cooperation Hello.

By No.18


Original: Large column  [ASP.NET] VS14 and ASP.NET VNext


Guess you like

Origin www.cnblogs.com/chinatrump/p/11468398.html