The Minimal ASPNET 1.1 App

The Minimal ASPNET 1.1 App

In a previous article, I described how to create the minimal ASP.NET Core 1.0 app. That is, what’s the smallest amount of code you could write to produce an ASP.NET Core application?

In this article, I’ll demonstrate how to do the same for ASP.NET Core 1.1. The main difference is in the project file, which has moved from project.json to a .csproj format. If you’re just getting started with .NET Core, install the SDK and tools, first. You can use Visual Studio Code (or any text editor) for these steps. Once you have the SDK and command line tools installed, open a command prompt in an empty folder. Run the following commands:

This will create two files, Program.cs and [foldername].csproj. Next, you need to add a package reference to the project file, to add the built-in ASP.NET Core web server, Kestrel, to the project. Open the .csproj file with Visual Studio Code (or another text editor). Add this code block under the PackageReference element that includes the “Microsoft.NETCore.App” package:

The complete project file after this change should look like this:

Now modify Program.cs to configure a web host, tell it to use Kestrel, and set up a single response to all requests (to return “Hi”):

Return to your command prompt, and run these commands:

You should see output like this:

minimal-aspnetcore11-program

Open a browser and navigate to localhost:5900. You should see a simple response of “Hi”.

  • leopignataro

    THANK YOU SO MUCH! I’ve been struggling for YEARS with the new perfmon!

  • ukbeachbum

    Whoever thought removing “save” was a good idea needs taking outside and being dunked in rotten cabbage!!

  • Amature

    Thank you very much.

    I did the same thing, machine_A works fine, but on machine_B, when I clicked on the saved perfmon.mmc on the desktop, I got the error ‘The remote procedure call failed’. These are the counters on the local machine_B, not like I try to get the

  • Amature

    Sorry the post was not done when I hit the arrow, didn’t realize it was the Submit button, so I am posting again.

    Thank you very much.

    I did the same thing, machine_A works fine, but on machine_B, when I clicked on the saved perfmon.mmc on the desktop, I got the error ‘The remote procedure call failed’. These are the counters on the local machine_B, not like I try to get the counters of a remote machine. Could you please let me know which rules I should enable on the Windows Firewall Advanced Settings? Thanks!

  • Markus Pope

    You could add “/a” to the shortcut…

  • Brian Garrity

    very useful, thanks!

  • Eric Halsey

    Fantastic thanks!
    Eric Halsey

  • Peter

    Thanks for this. I was wondering how to deal with this issue in Windows2012. I tested out 3 options here. Personally I believe the MMC way is the best way.

  • Fabio Santos

    muito obrigado. a terceira opcao era realmente o que eu procurava.

  • Pat

    Not to mention that perfmon is absolutely riddled with bugs

  • odinserj
    • johnkors

      Article: 2 days old. Already out of date. I like the new MS 🙂

      • ardalis

        Yeah, things are still moving quickly on the tooling side of things. Don’t worry, there will be more updates (on MS’ side and to this article) coming soon.