Reputation: 30355
I use the web command to run a console Kestrel web service from the default project setup in Visual Studio. When Kestrel is already running, then it fails to start because the port is occupied, so I need to close the running one first. Is it possible to add some parameters or some other way to make it automatically kill running Kestrel? E.g. on IISExpress you can run as much as you like, no need to kill the running IISExpress.
It looks like that for me now:
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
}
Upvotes: 1
Views: 2810
Reputation: 2030
The problem is that by default, all projects are configured to run at port 5000, IISExpress is able to run multiple services at the same time because it registers each in a different port. To do this with Kestrel you need to specify the port in the launch command. You can do this in the project.json file on the commands section, changing the web command to something like this
"web": "Microsoft.AspNet.Kestrel --server.urls http://localhost:5004"
source: http://docs.asp.net/en/latest/fundamentals/servers.html
Upvotes: 0