问题
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