@Suren Manawatta You can try to 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, typicallylocalhost
. Provide the name of the app at the end of the URL. For example,https://localhost/WebApplication1
(HTTPS) orhttp://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 ofDevelopment
. - 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
<AspNetCoreHostingModel>
property in its project file, the value of the property (InProcess
orOutOfProcess
) 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 eitherIn Process
orOut Of Process
as needed. - Save the profile. You should now be able to debug your application with IIS. Make sure to set your build configuration to Debug, and the profile to IIS. Then click the run button to start your application. More information you can refer to this link: IIS launch profile.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.