19

I have been able to run ASP.NET core applications with Visual Studio 2017. Visual Studio has the integration of IIS Express and ASP.NET core all setup and it works with F5.

I would like to get this same functionality in VS Code. I have found and tried the IIS extensions for VS code. They serve the files without launching the dotnet.exe process.

How can I configure my VS Code project to provide similar run/debug functionality as Visual Studio 2017?

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Matthew MacFarland
  • 2,413
  • 3
  • 26
  • 34
  • 3
    Unfortunately, ASP.NET Core on IIS Express require VS tricks, https://blog.lextudio.com/how-visual-studio-launches-iis-express-to-debug-asp-net-core-apps-d7fd3677e3c3 Thus, if you want the same functionality, you would have to implement it yourself. – Lex Li Aug 17 '17 at 20:46
  • 3
    According this excellent article it appears that I should not even bother trying to set this up. [Publishing and Running ASP.NET Core Applications with IIS](https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications-with-IIS) – Matthew MacFarland Aug 17 '17 at 20:52
  • 1
    @LexLi Your blog article was very helpful. I think I will give up on this task and do my local debugging without IIS/Express. – Matthew MacFarland Aug 17 '17 at 21:04
  • 2
    If you don't need IIS express, you could use the dotnet CLI like `dotnet run` to run it. VS Code can be configured to debug through that way too. – Talon Mar 09 '21 at 19:28
  • @Talon even without IIS Express, `dotnet run` is not likely to be the right one to use. `dotnet watch` is designed for such scenarios, https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-watch – Lex Li Mar 24 '23 at 04:31

2 Answers2

1

There is an extension available in visual studio market place which can be used to configure and host web applications in IIS Express from VS Code. Check it our here. https://marketplace.visualstudio.com/items?itemName=warren-buckley.iis-express

yenkay
  • 104
  • 4
  • Though accepted, this isn't the real answer. That extension doesn't work with ASP.NET Core or Blazor because its simple code base doesn't attempt to emulate the complex mechanism that VS uses. – Lex Li Mar 24 '23 at 04:29
1

Instead of leaving this question open and incorrect answers posted between 2018-2022, I am offering an answer with hints to guide whoever wants this.

Unfortunately, ASP.NET Core on IIS Express require VS tricks like I wrote a long while ago. Thus, if you want the same functionality, you would have to implement it yourself.

Note that this rules out all kinds of simple IIS Express extensions for VS Code as none of them attempted to go this far.

If you have both VS and VS Code installed on the same machine, then the new IIS/IIS Express extension for VS Code might help a little bit. By integrating with Jexus Manager and VS, it can start/stop the web apps (but still need a lot of further tuning).

You should consider alternative ways to set up your development workflow, and dotnet watch is one of them.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • 1
    Yeah. I agree. I remember I gave up even trying this. It's not worth the trouble and there are other ways without using IIS Express as you point out. I haven't used IIS express in a long time since .NET core. – Matthew MacFarland Mar 24 '23 at 19:52