.netasp.net-coreiis.net-core-3.0core-api

How to Host .net Core 3.0 Web Api on IIS?


I am trying to run .net core web Api on Remote PC by hosting it on IIS. I am able to run application locally. Api works fine when it is run through PostMan.

I can run the application using IP address also by using

UseUrls("http://localhost:5000", "http://localhost:21868","http://*.*.*.*:5000")

in program.cs(Self hosted Application using kestral). Set up done in applicationhost.config

<binding protocol="http" bindingInformation="*:21268:localhost" />

I tried to run API without debugging on remote PC by hosting it on IIS but I am unable to do that ?

EDIT:

Error I am getting while I am trying to host-

Unable to connect to web server iisexpressandinvalid URl: the hostname could not be parsed.


Solution

  • Missing thing was- Enable Development time IIS support while doing set up of Visual studio 2017/2019 as native IIS module is required to run ASP.NET Core applications on IIS.

    After that I could set the Launch as in IIS in Project Properties. Below Link I found helpful to host core application on IIS.

    https://devblogs.microsoft.com/aspnet/development-time-iis-support-for-asp-net-core-applications/