If you're a Visual Studio co-dependent like I am, then you live and breath website development from within this code editor environment.  And you may have had aspirations of using something a little more lightweight like Sublime (a little further back perhaps) , Jet Brain's Webstorm, or even Visual Studio Code.  Cuz that's what he cool kidz talk about.  But after the initial excitment of spinning up a new code editor up, do you feel like you're spending way more time staring at the screen rather than coding some code. 

Coding MFucker!

Then itching to get back into your programming comfort zone.  I've been there.  No shame, no judging here.   Although I'm pretty mean with Markdown in some Visual Studio Code - hey it's a start!

Anyways, as I'm doing more and more .Net Core Development (v 2.1 at the time of writing), getting a feel for the ins and out,  I'm everyday peeling myself away from the web server familiar of IIS and it's little cousin IIS Express.  And turning to running the Core .exe process directly.  Known as Project in the...um... project properties.  

Breaking it down now.

 The 3 types of Dev "Web Servers" that you may encounter in .net Core:

  1. Project
    1. Under the hood, running this will call the the command “dotnet run”  (and few other commands internally) from .Net Core Command Line. The result is that this will launch the Kestrel web server.
  2. IIS Express
  3. Local IIS (the classic, baby
    1. Will generate a web.config
    2. Make sure place this web.config in your .gitignore file as it’s more a local user setting thing now

For .net Core projects Local IIS support has to be added into Visual Studio 2017. It's not built in like it is for .Net Framework projects. I'll cover this in a follow up Post.

In your web project's "Properties -> Debug" settings you can create Profiles for these web servers that update a local launchSettings.json file. Here's what it looks like:

web-server-project.PNG

web-server-express.PNG

web-server-iis.PNG

Note: You can create New and Delete profile to the right.

When F5 Debug within Visual Studio, make sure correct Profile is selected at the top!

vs-server-chosen.PNG

Sources:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1

 

https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-run?tabs=netcore21

https://exceptionnotfound.net/working-with-environments-and-launch-settings-in-asp-net-core

Comments


Comments are closed