NOTE: The below steps are not the only right one and may not apply in all cases how to host .Net Core app in the IIS. It also depends how the project is configured and startup setup. The below steps work for the sample Dancing Goat Core project. If the below does not work for you, you need to find some other way how to deploy the project, e.g. looking on MSDN, Google or Stackoverflow.
You need to usually publish or deploy the Core app. There are several good articles on this topic on the Internet. Or, for local development, so I do not have to publish it every time, I do this:
- Open the Core project in Visual Studio. (I am using the sample DancingGoatCore project)
- Right-click on the DancingGoatCore project and select Properties.
- On the Debug tab, create a new Profile called IIS - sample screen shot
- Configure the following (screen shot):
Profile: IIS
Launch: IIS
Launch browser: Checked (but leave the URL empty)
Environment variables: Add a new one, Key = ASPNETCORE_ENVIRONMENT, Value = Development
App URL: e.g. http://localhost/K13_DancingGoatCore
Hosting Model: Default (In Process)
5.Save the properties.
6. Change the default run profile in Visual Studio to IIS (screen shot)
Now run the website from Visual Studio for the first time. When you first run the application, a new Application Pool and a new application under the Default Website will automatically be created in IIS (screen shot)
7. Configure the Presentation URL in administration interface (Sites application -> < edit site > -> General -> Presentation URL) to the app URL you specified in Step 4.
And now, I can just browse http://localhost/K13_DancingGoatCore without need to run Visual studio or publishing the app. Of course, when you make code changes in the Core app, you need to build it in VS.