asp-development-time IIS

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?view=aspnetcore-3.1

Visual Studio may prompt a restart if not running as an administrator. If prompted, restart Visual Studio.

Enable development-time IIS support in Visual Studio

Launch the Visual Studio installer.

Select Modify for the Visual Studio installation that you plan to use for IIS development-time support.

For the ASP.NET and web development workload, locate and install the Development time IIS support component.

The component is listed in the Optional section under Development time IIS support in the Installation details panel to the right of the workloads. The component installs the ASP.NET Core Module, which is a native IIS module required to run ASP.NET Core apps with IIS.

IIS launch profile

Create a new launch profile to add development-time IIS support:

Right-click the project in Solution Explorer. Select Properties. Open the Debug tab.

For Profile, select the New button. Name the profile “IIS” in the popup window. Select OK to create the profile.

For the Launch setting, select IIS from the list.

Select the checkbox for Launch browser and provide the endpoint URL.

When the app requires HTTPS, use an HTTPS endpoint (https://). For HTTP, use an HTTP (http://) endpoint.

Provide the same host name and port as the IIS configuration specified earlier uses, typically localhost.

Provide the name of the app at the end of the URL.

For example, https://localhost/WebApplication1 (HTTPS) or http://localhost/WebApplication1 (HTTP) are valid endpoint URLs.

In the Environment variables section, select the Add button. Provide an environment variable with a Name of ASPNETCORE_ENVIRONMENT and a Value of Development.

In the Web Server Settings area, set the App URL to the same value used for the Launch browser endpoint URL.

For the Hosting Model setting in Visual Studio 2019 or later, select Default to use the hosting model used by the project. If the project sets the property in its project file, the value of the property (InProcess or OutOfProcess) is used. If the property isn’t present, the default hosting model of the app is used, which is in-process. If the app requires an explicit hosting model setting different from the app’s normal hosting model, set the Hosting Model to either In Process or Out Of Process as needed.

Save the profile.

Q&A

Config Error: Cannot read configuration file due to insufficient permissions
Config File: C:\Users\me\Documents\wwwroot\httpdocs\web.config

You need to give permission to C:\Windows\System32\inetsrv\config folder to IIS_IUSRS user.

w3wp.exe keeping files locked after processing in webservice

Try to either recycle the AppPool which your webservices runs under, or use iisreset.

iisreset /stop will stop IIS and release the dll’s. iisreset /start will start IIS back up again.