Last post Apr 14, 2020 11:08 AM by karenvc2020
Apr 10, 2020 04:55 PM|karenvc2020|LINK
I have spent considerable time trying to do what I thought would be a simple task: Debugging my website in Visual Studio on local IIS (using .core MVC) on my Windows 10 PC (instead of IIS Express) - or just being able to see it in localhost.
I haven't really worked on the site yet - it is just the template site that is created in Visual Studio for .Core MVC. When I debug with IIS Express it works fine.
I am new to .core mvc but have previously worked with .net framework and .net forms. Using this with localhost was easy. I just had to setup my site in IIS. I would then run localhost and the files I would see in Visual Studio (2013) would appear in the
I have tried to do the same with Visual Studio 2019 (a .core mvc site). However when I run localhost I get 404 - page not found (HTTP Error 404. The requested resource is not found). I have made sure that index.aspx and index.cshtml are included in default
documents in IIS if this was required.
I have been through several pages on the ASP.net docs website along with several other forums looking for a solution. What I am unclear about is
I have been through the following pages on Microsoft Docs:
These steps included installing the .NET Core Hosting Bundle which I have done.
Just to clarify using the debug options at the top of Visual Studio if I pick IIS express it works fine and the home page loads - if I select the debug profile for localhost that I setup I get the 404 page. I don't get any errors on build.
I would very much appreciate any advice.
Apr 11, 2020 05:28 AM|timur.kh|LINK
One thing to check would be whether your VS is started as Administrator - when you open an IIS project, VS tries to set the application up for you, which might fail if you don't have enough rights. Which can in turn cause your debug to fail completely.
Apr 11, 2020 10:50 AM|karenvc2020|LINK
Thank you for replying and your suggestion. However, this isn't the problem as I have been using VS in administrator mode.
Apr 11, 2020 07:27 PM|KathyW|LINK
Have you followed all the links in the ones you quoted?
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1 Host ASP.NET Core on Windows with IIS (this doesn't happen out of the
box - and it's not just installing the hosting bundle)
looking at the "Debug ASP.NET Core apps" section
Apr 13, 2020 04:42 PM|karenvc2020|LINK
Many thanks for your reply. I have gone through all the steps again. This is a summary:
<?xml version="1.0" encoding="utf-8"?>
<location path="." inheritInChildApplications="false">
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<aspNetCore processPath="C:\_CurrentLT\Data\Websites\[mysitename]\bin\Debug\netcoreapp3.1\[mysitename].exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
<environmentVariable name="ASPNETCORE_HTTPS_PORT" value="44366" />
<environmentVariable name="COMPLUS_ForceENC" value="1" />
<directoryBrowse enabled="true" />
<add value="Index.cshtml" />
<add value="Index.aspx" />
I also wanted to include a screenshot but I can't work out how to do this. Ctrl v does not work and the add image just seems to be for online images - not to upload files. Any help on this would also be appreciated.
Any help or suggestions on the above will be much appreciated.
Apr 13, 2020 05:53 PM|mgebhard|LINK
If I understand you want to connect the Visual Studio debugger to an application running on localhost (IIS). I'm not sure if that's possible. But, it's far more powerful to debug in Visual Studio because you get to see the debug information immediately
in the output window or console depending on your setup. I do dotnet run with the "watch" switch so every time I save a file it complies and runs the code.
Apr 14, 2020 11:08 AM|karenvc2020|LINK
Thank you to all who took time to take a look at this.
As can be the case, it is a simple problem that caused it - in that I didn't have my site binding setup correctly.