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
I have tried the following:
However, nothing is working. When I start to debug I get a page that either says "Service Unavailable" or "Invalid URL".
What am I missing?
p.s. I am using Visual Studio 2013
Switch HTTP to HTTPS for an existing app in Visual Studio For the web project configured running on HTTP, right click the project and click properties: The Project Properties Window is open, click Web Tab, we can see that the Project Url is HTTP protocol.
Click the Web tab. In the Servers section, under dropdown selection for IIS Express, change the port number in the Project URL box. To the right of the Project URL box, click Create Virtual Directory, and then click OK.
For Visual Studio 2015 the steps in the above answers apply but the applicationhost.config file is in a new location. in your "solution" folder follow the path
\.vs\config
Within that folder you will see your applicationhost.config file
Alternatively you could just search your solution folder for the .config file and find it that way.
I personally used the following configuration:
With the following in my hosts file:
127.0.0.1 jam.net
127.0.0.1 www.jam.net
And the following in my applicationhost.config file:
<site name="JBN.Site" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Dev\Jam\shoppingcart\src\Web\JBN.Site" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:49707:" />
<binding protocol="http" bindingInformation="*:49707:localhost" />
</bindings>
</site>
Remember to run your instance of visual studio 2015 as an administrator! If you don't want to do this every time I recomend this:
How to Run Visual Studio as Administrator by default
I hope this helps somebody, I had issues when trying to upgrade to visual studio 2015 and realized that none of my configurations were being carried over.
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
Although it seems that it can be done with some extra work, see this question for more details.
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.
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With