r3plica
r3plica

Reputation: 13367

subdomains on local development server (Visual Studio 2013)

First of all, I have managed this before on another machine using VS 2012 and Windows 8. The only difference I can see with this machine is that I am using VS 2013.

So, I have set up my host file to have this:

127.0.0.1   localhost
127.0.0.1   localhost:3892

127.0.0.1   r3plica.localhost
127.0.0.1   r3plica.localhost:3892

On my working machine the localhost:3892 doesn't exist and it works without it. In visual studio everything is set as default. When I f5 the browser goes to localhost:3892 and everything works as expected.

On my other machine, if I change the URL to r3plica.localhost:3892 the expected website loads and I can still debug it (debugging is what I need to do).

On my new machine if I change to the new URL I get a Bad Request error.

I have searched the internet and can not find the solution, so if anyone has had the same issue, please help me fix it! :D

Cheers,
/r3plica

Upvotes: 2

Views: 1961

Answers (1)

Steve Kennaird
Steve Kennaird

Reputation: 1674

I managed to solve this issue by:

  • Running Visual Studio in admin mode
  • Forcing IIS Express to run in admin mode too (locate iisexpress.exe in C:\Program Files (x86)\IIS Express\, right click and select Properties then Compatibility tab then tick the 'Run this program as an administrator' checkbox).
  • Modifying the applicationhost.config file for IISExpress for the site you're debugging. The file can be found at Documents > IISExpress > config. Find the relevant site node and change the bindingInformation attribute to the below (but putting your port number in):

    <site name="MyWebsite.UI" id="52">
        <application path="/" applicationPool="Clr4IntegratedAppPool">
            <virtualDirectory path="/" physicalPath="C:\Dev\Code\Latest\MyWebsite.UI" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:55079:*" />
        </bindings>
    </site>
    

Note the bindingInformation attribute value is:

*:{PortNumber}:*

instead of:

*:{PortNumber}:localhost

Upvotes: 4

Related Questions