Why Kestrel doesn't listen at specified port?

好久不见. 提交于 2019-12-06 08:38:37

Kestrel is the port used by the application. IIS Express serves as a kind of reverse proxy.

If you want to access the port configured by kestrel, you have to start it as console application. Click the drop-down button next to the start-button and select YourCompany.YourApplication.Mvc (or whatever your project is called) instead of "IIS Express". Then click start and the application start and an console window appears.

Save it and then start the application/debugging.

If you still want to use IIS-Express (because you want to host it on IIS and want closer experience to it), then go to the project properties, choose the "Debug" tab, select the "IIS Express" profile in the drop down and then change the "App URL". This will update the launchSettings.json file and the IIS Express config (.vs/config/applicationhost.config) with the new port.

I would strongly advice against manually editing the launchSettings.json file, as this may leave the applicationhost.config untouched (which really determines the port, launchSettings.json just tells the IDE which URL to open in the browser).

If for any reason your urls in launchSettings.json / applicationhost.config are out of sync, you can manually edit the applicationhost.config or just delete it (the .vs folder is typically hidden, you may have to show hidden folders in your explorer first) and it will be recreated on the next opening of the solution and/or running the application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!