本地主机 ASP.NET 网站的友好 URL
我将 Visual Studio 2010 与 ASP.NET 4.0 和 IIS7 一起使用。 当我打开我的网站时,URL 看起来像这样
http://localhost:6549/Website/help/tab/contact-us
我想要一个友好的 URL:
http://mysite/help/tab/contact-us
或任何可以帮助我从 URL 中删除端口 6549
http://localhost/Website/help/tab/contact-us
我使用 ASP.NET 开发服务器,这就是 Visual当您运行本地主机网站时使用 Studio
等待!请区分项目的“属性窗口”和“属性页”。我总是尝试你的建议,但使用“属性页”,并且该页面上没有像使用动态端口这样的属性。该属性只能在“属性窗口”中找到
I Use Visual Studio 2010 with ASP.NET 4.0 and IIS7.
When I open my site, the URL looks like this
http://localhost:6549/Website/help/tab/contact-us
I want a friendly URL:
http://mysite/help/tab/contact-us
or anything that will help me to get rid of the Port 6549
from URL
http://localhost/Website/help/tab/contact-us
I use ASP.NET Development Server which is what Visual Studio use when you run a localhost website
Wait !! Please make distinction between "Properties window" and "Property pages" of the project. I always tried your advices, but using "Property pages", and there is no such property like Use dynamic ports on that page. This property can be found only in the "Properties window"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设它是 ASP.NET 开发服务器:
要删除端口号,您需要执行以下操作
- 转到项目的属性
- 单击网络选项卡
- 检查特定端口并分配80
这里还有一个虚拟路径设置,您可以将其设置为 /
Assuming it's the ASP.NET development server:
To get rid of the port number you need to do this
- go to properties of the project
- click the web tab
- check the specific port and assign 80
There is also a virtual path setting here which you could set to /
您的解决方案是否配置为使用 IIS 而不是 ASP.NET 开发服务器? Web 应用程序上还有一个属性,您可以在其中指定端口(或允许选择随机端口) - 端口 80 是适当的端口 - 这需要管理员访问正在启动网站的进程。
Is your solution configured to use IIS and not the ASP.NET Development Server? There is also a property on the web application where you can specify the port (or allow for a random port to be chosen) - port 80 is the appropriate port - this requires administrator access to the process that is launching the web site.
编辑:
我以为你可以使用你的主机文件来重定向用户,但我检查过,你不能重定向到端口。
如果您的计算机上有 IIS7,只需将 Web 开发文件夹的位置放入 IIS 上的虚拟目录即可。
然后你可以通过 http://localhost/website/ 访问它
Edit:
I was thinking you can use your host file to redirect the user, but I checked and you can't redirect to a port.
If you have IIS7 on the machine, just make the location of your web development folder into a virtual directory on IIS.
Then you can access it by http://localhost/website/