A 30 Minute Look At ASP.NET vNext

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

This week at TechEd, the ASP.NET team announced some pretty exciting updates on the way for ASP.NET. Top Links Blog Posts Here’s what that gets me: C:UsersJonDesktopHome-masterHome-master>dir
Volume in drive C has no label.
Volume Serial Number is 5E2E-AE5E

Directory of C:UsersJonDesktopHome-masterHome-master

05/13/2014 02:29 PM .
05/13/2014 02:29 PM ..
05/13/2014 01:51 PM 851 .gitattributes
05/13/2014 01:51 PM 245 .gitignore
05/13/2014 01:51 PM 1,513 CONTRIBUTING.md
05/13/2014 01:51 PM 356 kvm.cmd
05/13/2014 01:51 PM 17,278 kvm.ps1
05/13/2014 01:51 PM 28 kvmsetup.cmd
05/13/2014 01:51 PM 592 LICENSE.txt
05/13/2014 01:51 PM 481 NuGet.Config
05/13/2014 01:51 PM 6,390 README.md
05/13/2014 02:29 PM samples
9 File(s) 27,734 bytes
3 Dir(s) 11,363,086,336 bytes free

The next step in the readme tells me to execute kvmsetup.cmd, which tells me this:

Copying file C:UsersJon.krebinkvm.ps1
Copying file C:UsersJon.krebinkvm.cmd
Adding C:UsersJon.krebin to process PATH
Adding C:UsersJon.krebin to user PATH
Adding C:Program FilesKRE;%USERPROFILE%.kre to process KRE_HOME
Adding C:Program FilesKRE;%USERPROFILE%.kre to machine KRE_HOME
Press any key to continue …

And with that, we’ve got the version manager installed. Important: this is the version manager, not the runtime. We can install multiple versions of the runtime engine, and use kvm to select the active one for a project.

Next, the readme tells me to install a named version of the K Runtime Engine: kvm install 0.1-alpha-build-0421

C:UsersJonDesktopHome-masterHome-master>kvm install 0.1-alpha-build-0421
Downloading KRE-svr50-x86.0.1-alpha-build-0421 from https://www.myget.org/F/aspnetvnext/api/v2/
Installing to C:UsersJon.krepackagesKRE-svr50-x86.0.1-alpha-build-0421
Adding C:UsersJon.krepackagesKRE-svr50-x86.0.1-alpha-build-0421bin to process PATH

Now we’ve got a runtime installed, so we can run some samples. The readme recommends running the console sample first, and I think that makes sense since it’s an incredibly simple app that verifies things are installed. So I cd to samplesConsoleApp and run kpm restore. This looks scary, but it’s really fast, and it’s a good thing. The idea is that instead of running on big, monolithic framework assemblies, ASP.NET vNext is grabbing a bunch of small, focused NuGet packages.

C:UsersJonDesktopHome-masterHome-master>cd samplesConsoleApp

C:UsersJonDesktopHome-masterHome-mastersamplesConsoleApp>kpm restore

C:UsersJonDesktopHome-masterHome-mastersamplesConsoleApp>CALL “C:UsersJon.krepackagesKRE-svr50-x86.0.1-alpha-build-0421binKLR.cmd” –lib “C:UsersJon.krepackagesKRE-svr50-x86.0.1-alpha-build-0421bin;C:UsersJon.krepackagesKRE-svr50-x86.0.1-alpha-build-0421binlibMicrosoft.Framework.PackageManager” “Microsoft.Framework.PackageManager” restore
Restoring packages for C:UsersJonDesktopHome-masterHome-mastersamplesConsoleAppproject.json
Attempting to resolve dependency ConsoleApp >= 1.0.0
Attempting to resolve dependency System.Console >= 4.0.0.0
GET https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Console’
GET https://nuget.org/api/v2/FindPackagesById()?Id=’System.Console’
Attempting to resolve dependency mscorlib >=
Attempting to resolve dependency System >=
Attempting to resolve dependency System.Core >=
Attempting to resolve dependency Microsoft.CSharp >=
Attempting to resolve dependency ConsoleApp >= 1.0.0
Attempting to resolve dependency System.Console >= 4.0.0.0
OK https://nuget.org/api/v2/FindPackagesById()?Id=’System.Console’ 931ms
OK https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Console’ 972ms
GET https://www.myget.org/F/aspnetvnext/api/v2/package/System.Console/4.0.0.0
OK https://www.myget.org/F/aspnetvnext/api/v2/package/System.Console/4.0.0.0 1696ms
Attempting to resolve dependency System.IO >= 4.0.0.0
GET https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.IO’
GET https://nuget.org/api/v2/FindPackagesById()?Id=’System.IO’
Attempting to resolve dependency System.Runtime >= 4.0.0.0
GET https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Runtime’
GET https://nuget.org/api/v2/FindPackagesById()?Id=’System.Runtime’
OK https://nuget.org/api/v2/FindPackagesById()?Id=’System.Runtime’ 659ms
OK https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.IO’ 838ms
OK https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Runtime’ 841ms
GET https://www.myget.org/F/aspnetvnext/api/v2/package/System.Runtime/4.0.20.0
OK https://nuget.org/api/v2/FindPackagesById()?Id=’System.IO’ 954ms
GET https://www.myget.org/F/aspnetvnext/api/v2/package/System.IO/4.0.0.0
OK https://www.myget.org/F/aspnetvnext/api/v2/package/System.IO/4.0.0.0 1779ms
Attempting to resolve dependency System.Text.Encoding >= 4.0.0.0
GET https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Text.Encoding’
GET https://nuget.org/api/v2/FindPackagesById()?Id=’System.Text.Encoding’
Attempting to resolve dependency System.Threading.Tasks >= 4.0.0.0
GET https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Threading.Tasks’
GET https://nuget.org/api/v2/FindPackagesById()?Id=’System.Threading.Tasks’
OK https://www.myget.org/F/aspnetvnext/api/v2/package/System.Runtime/4.0.20.0 1919ms
OK https://nuget.org/api/v2/FindPackagesById()?Id=’System.Text.Encoding’ 746ms
OK https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Text.Encoding’ 837ms
GET https://www.myget.org/F/aspnetvnext/api/v2/package/System.Text.Encoding/4.0.10.0
OK https://www.myget.org/F/aspnetvnext/FindPackagesById()?Id=’System.Threading.Tasks’ 843ms
OK https://nuget.org/api/v2/FindPackagesById()?Id=’System.Threading.Tasks’ 1051ms
GET https://www.myget.org/F/aspnetvnext/api/v2/package/System.Threading.Tasks/4.0.0.0
OK https://www.myget.org/F/aspnetvnext/api/v2/package/System.Text.Encoding/4.0.10.0 1356ms
OK https://www.myget.org/F/aspnetvnext/api/v2/package/System.Threading.Tasks/4.0.0.0 1721ms
Resolving complete, 8357ms elapsed
Installing System.Console 4.0.0.0
Installing System.Runtime 4.0.20.0
Installing System.IO 4.0.0.0
Installing System.Text.Encoding 4.0.10.0
Installing System.Threading.Tasks 4.0.0.0
Restore complete, 8495ms elapsed

Now I run it with k run:

C:UsersJonDesktopHome-masterHome-mastersamplesConsoleApp>k run
Hello World

C:UsersJonDesktopHome-masterHome-mastersamplesConsoleApp>

Like I said, not all that exciting. Just a quick verification check. Now that I know that’s working, I’ll quickly pop into one of the other sandbox samples, the HelloWeb one. Notice how simple the startup.cs file is (the official walkthrough explains it in detail).

C:UsersJonDesktopHome-masterHome-mastersamplesHelloWeb>dir
Volume in drive C has no label.
Volume Serial Number is 5E2E-AE5E

Directory of C:UsersJonDesktopHome-masterHome-mastersamplesHelloWeb

05/13/2014 02:29 PM .
05/13/2014 02:29 PM ..
05/13/2014 01:51 PM 310,647 image.jpg
05/13/2014 01:51 PM 506 project.json
05/13/2014 01:51 PM 227 Startup.cs
3 File(s) 311,380 bytes
2 Dir(s) 11,368,951,808 bytes free

C:UsersJonDesktopHome-masterHome-mastersamplesHelloWeb>copy startup.cs con
using Microsoft.AspNet.Builder;

namespace KWebStartup
{
public class Startup
{
public void Configure(IBuilder app)
{
app.UseStaticFiles();
app.UseWelcomePage();
}
}
} 1 file(s) copied.

C:UsersJonDesktopHome-masterHome-mastersamplesHelloWeb>

Now I’ll call kpm restore , just like before. This time kpm restore takes a bit longer, because there are more included packages (listed in project.json) and their dependencies.

And I’m ready to run it. This time, instead of k run, I’ll call k web since it’s a web app. If I forget and call k run, it reminds what’s what:

C:UsersJonDesktopHome-masterHome-mastersamplesHelloWeb>k run
‘HelloWeb’ does not contain a static ‘Main’ method suitable for an entry point

Fine, k web it is. It tells me the server’s started, but how do I view it? Well, the readme tells me it’s at http://localhost:5001, but if I didn’t know I could consult the commands section of project.json:

“commands”: {
“web”: “Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001”
}

Simple enough. And browsing to that gives me a cool hello world page:

Nerd note: That page is shown because we’ve got app.UseWelcomePage() in startup.cs. There are no images or css in the project because everything’s contained in the emitted HTML. It’s actually really impressive – it’s got embedded fonts, images as data:urls, CSS, and a minimized version of jQuery (for some nice animations), so it’s a 287KB HTML payload… but since it’s being served locally and you’re not going to run this in production, not a problem.

Nerd smackdown: David Fowler reminded me that this welcome page has been in Katana for a while.

Music Store

Okay, now that I’ve got this stuff installed, let’s see how fast I can get the Music Store sample running.

Step 1: Grab the zip from https://github.com/aspnet/MusicStore, verify it’s not blocked, and unzip on desktop.

Step 2: Run kpm restore.

Step 3: Select the hosting opeion (Helios, SelfHost, CustomHost – explained here). In this case I’ll stick with selfhost, so I run k web and browse to localhost:5002:

Yippee!

Again, the point is that it’s pretty quick and painless to get started and play with the samples; just follow the walkthroughs. If you’re used to Node or Rails a lot of these steps should seem pretty familiar. If you’re not and this freaks you out, don’t be freaked out… this will all work smoothly from within Visual Studio in the release version. This is a preview. Take a look! Have Fun! Let us know what you think!

Videos

The best way to get up to speed is by watching the videos I mentioned earlier.

 

X ITM Cloud News

Ana

Next Post

weblogs.asp.net Now Running On Orchard and Azure Web Sites

Mon Nov 25 , 2019
Spread the love          I’m incredibly happy to announce that my blog – and all 750 other blogs running under weblogs.asp.net – are now powered by Orchard and Azure Web Sites! That’s 750 blogs, all hosted in 4 Azure Web Sites all running on only one large virtual machine. A bit of […]
X- ITM

Cloud Computing – Consultancy – Development – Hosting – APIs – Legacy Systems

X-ITM Technology helps our customers across the entire enterprise technology stack with differentiated industry solutions. We modernize IT, optimize data architectures, and make everything secure, scalable and orchestrated across public, private and hybrid clouds.

This image has an empty alt attribute; its file name is x-itmdc.jpg

The enterprise technology stack includes ITO; Cloud and Security Services; Applications and Industry IP; Data, Analytics and Engineering Services; and Advisory.

Watch an animation of  X-ITM‘s Enterprise Technology Stack

We combine years of experience running mission-critical systems with the latest digital innovations to deliver better business outcomes and new levels of performance, competitiveness and experiences for our customers and their stakeholders.

X-ITM invests in three key drivers of growth: People, Customers and Operational Execution.

The company’s global scale, talent and innovation platforms serve 6,000 private and public-sector clients in 70 countries.

X-ITM’s extensive partner network helps drive collaboration and leverage technology independence. The company has established more than 200 industry-leading global Partner Network relationships, including 15 strategic partners: Amazon Web Services, AT&T, Dell Technologies, Google Cloud, HCL, HP, HPE, IBM, Micro Focus, Microsoft, Oracle, PwC, SAP, ServiceNow and VMware

.

X ITM