ASP .NET Core 2.0 Change “localhost” to a “hostname”

心不动则不痛 提交于 2019-12-06 10:28:08

问题


I have a Web App written based on MVC framework. It runs really well on the localhost and default port 51290. Now I need to run it using my domain name e.g. myhostname. What I have tried is to add a line in "applicationhost.config" section:

            <binding protocol="http" bindingInformation="*:80:myhostname" />

When I press Ctr+F5, I got an error msg saying port 80 is in use.

The server is IIS express.

Can someone please instruct how should I run this App using host name? Thanks.


回答1:


After I run visual studio as admin, everything worked!




回答2:


Win+R to open the Run dialog.and type "drivers"

now you can see "etc" folder,inside that there is a file named as "hosts".open that and change local host name to your domain name. http://www.c-sharpcorner.com/UploadFile/8d44fb/how-to-access-the-site-using-domain-name-instead-of-localhos/



来源:https://stackoverflow.com/questions/47171507/asp-net-core-2-0-change-localhost-to-a-hostname

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