问题描述
我是MVC的新手,我刚刚在VS 2010中创建了一个MVC4测试项目,它可以正常运行,但URL为 http://localhost:60826/我想将其更改为 http://my.test.site 或至少 http://my.test.site:60826/
I am new to MVC and I just created one MVC4 test project in VS 2010, it runs perectly but the url is http://localhost:60826/ I wanted to change it to http://my.test.site or at least http://my.test.site:60826/
我想我可以通过简单地在主机文件中放置一个条目来解决该问题,它将my.test.site解析为127.0.0.1,然后将URL更改为 http://my.test.site:60826 .但是它不起作用,我丢失了什么吗?
I thought I can achieve that by simply putting an entry in host file which will resolve my.test.site to 127.0.0.1 and then just change the url to http://my.test.site:60826 . However it is not working, Am I missing something?
通过仅在Internet选项->连接-> LAN设置->高级->例外列表下的代理忽略列表中添加"my.test.site",就可以实现此目的.现在,我可以从浏览器访问 http://my.test.site:60826/. (以防万一,如果您希望VS以 http://my.test.site:60826/,转到project-properties-web-start URL(在此处添加您的URL).
I was able to achieve this by just adding the 'my.test.site' in proxy ignore list under Internet Options-> Connections -> LAN Settings -> Advanced -> Exception list. now I can access http://my.test.site:60826/ from browser. (Just in case if you want VS to launch the page as http://my.test.site:60826/, go to project-properties-web-start URL add your url there).
现在下一步就是摆脱该端口号(60826),任何人都可以通过' http://my.test.site ",即没有任何端口号?
Now next step is to get rid of this port number(60826), can anyone throw any light on how to run my application as 'http://my.test.site' i.e. with out any port number?
推荐答案
您正在使用IIS还是IIS Express?如果是后者,则需要修改IIS项目URL.
Are you using IIS or IIS Express? If the latter, you need to modify the IIS Project URL.
- 右键单击您的Web项目
- 选择属性
- 在属性窗口中,选择网络标签.
- 提供项目URL :
http://localhost:60826/
- 提供覆盖应用程序根网址:
http://my.test.site:60826/
- 单击创建虚拟目录(您可能需要以管理员身份运行)以执行此操作.
- 打开:
%USERPROFILE%\My Documents\IISExpress\config\applicationhost.config
-
在节点中,将您的站点修改为如下所示:
- Right click your web project
- Select Properties
- In the Properties window, select the Web tab.
- Provide the Project URL:
http://localhost:60826/
- Provide the Override application root Url:
http://my.test.site:60826/
- Click Create Virtual Directory (You may need to be running as Administrator) to do this.
- Open up:
%USERPROFILE%\My Documents\IISExpress\config\applicationhost.config
In the node modify your site to look like the following:
<site name="SitenameHere" id="11">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\**usernameHere**\PathToProjectHere" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:60826:localhost" />
</bindings>
</site>
这篇关于在Visual Studio中将域名从本地主机更改为自定义名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!