更改项目URL的Visual Studio [英] Change Project URL Visual Studio

查看:241
本文介绍了更改项目URL的Visual Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想能够调试域上我的ASP.NET MVC应用程序除localhost以及任何其他子域,换句话说:

I would like to be able to debug my ASP.NET MVC application on a domain other than localhost as well as any subdomains, in other words:

http://domain.dev
HTTP://*.domain.dev

http://domain.dev http://*.domain.dev

我曾尝试以下内容:


  1. 修改hosts文件,

  2. 添加主机记录* .domain.dev返回127.0.0.1

  3. 更改项目URL'在项目属性。

但是,没有什么工作。当我开始调试,我得到一个网页,或者说服务不可用或无效的URL

However, nothing is working. When I start to debug I get a page that either says "Service Unavailable" or "Invalid URL".

我是什么失踪?

P.S。我使用Visual Studio 2013

p.s. I am using Visual Studio 2013

推荐答案

您需要实际在主机文件中的每个子域创建一个新的纪录。不能使用通配符。

You need to actually create a new record for each subdomain in the hosts file. You can't use wildcards.

127.0.0.1 domain.dev
127.0.0.1 foo.domain.dev
127.0.0.1 bar.domain.dev

虽然似乎它可以与一些额外的工作来完成,请参阅这个问题了解更多信息。

您还需要包含端口号访问URL时。浏览器将指向 http://foo.domain.dev:0000 ,使用分配的VS,当然端口号。

You also need to include the port number when accessing the URL. The browser would point to http://foo.domain.dev:0000, using the port number assigned in VS, of course.

如果您正在使用的Visual Studio开发服务器,这是所有有给它。如果使用IIS防爆preSS,它需要更多的工作。

If you are using the Visual Studio Development Server, that's all there is to it. If using IIS Express, it takes a bit more work.

然后,你需要确保你有在IIS ApplicationHost.config文件中的记录:

Then you need to make sure you have a record in the IIS applicationhost.config file :

<site name="YourApplication" id="25">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Path\To\Your\App" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:2750:foo.domain.dev" />
    </bindings>
</site>

更新

<site name="DomainProject" id="18">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\William\Source" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:32939:domain.dev" />
        <binding protocol="http" bindingInformation="*:32939:domain2.dev" />
    </bindings>
</site>

这篇关于更改项目URL的Visual Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆