在我的主机文件中,我提供了此选项 127.0.0.1 localhost mysite.com 这样我就可以使用我的自定义名称访问我的localhost站点(我可以通过在浏览器中键入http://mysite.com/直接访问该站点)。现在问题是我如何对我的VS2008做同样的事情。我想在浏览器中使用url调试我的应用程序,如http://mysite.com/。我尝试将“http://mysite.com/”放在我的webproject属性构建选项的使用本地IIS Web服务器选项文本框中,但我无法使用它运行我的项目。这是必须的,我必须只在该文本框中输入localhost url。你能帮我解决上述问题吗?
答案 0 :(得分:1)
在C:\ windows \ System32 \ drivers \ etc。
上编辑文件HOSTS喜欢这个......
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 my.domain.com
现在,在您的浏览器上,拨打http://my.domain.com/APPLICATION
希望它有所帮助。
答案 1 :(得分:1)
您必须在IIS中设置一个站点,主机名指向您站点的url:mysite.com。然后转到项目选项,Web选项卡并选择使用locakl IIS Web服务器,将项目URL指定为http://mysite.com