I am currently trying to build an API with asp.net core. It is essentially a micro service that can only be called by another Web API. It is only being used in an intranet setting behind a firewall that protects it from the public. Originally I was planning to use it with just Kestrel, without a reverse proxy, but I decided to try it behind IIS just for the fact that IIS can restart the process if something goes wrong.
There are two problems I've seen with this setup so far.
1) IIS seems to always start the dotnet core app on a random port. I haven't been able to find anyway around this, but I would like it to use a specified port.
2) When I make a request, IIS seems to start the dotnet core app and then kill the process immediately after the request is finished. I can actually watch the process start and die all within 2 seconds.
I have tried the following:
- I changed Start Mode to AlwaysRunning -> This instantly starts the app, but the process dies as soon as a request is completed (no errors logged)
- Idle Time-out -> 0
- None of the Recycling Conditions are selected
So my questions:
1) Is this all normal behavior?
2) Since this is an intranet setting I assume it would be fine to just run the app without IIS. Is there a best practice on a Windows Server setting to keep the Kestrel process running. In other words, if the process dies for some reason (unhandled exeption, server problems, etc), is there a best practice for restarting the process?