Reputation: 6830
I have an ASP .NET Web Application project Visual Studio 2013, which I use for testing purposes only. I'm using pretty much the default project setup:
localhost
- other hosts results in a Bad Request - Invalid Hostname
response.I want to be able to send requests and recieve responses from another machine on my LAN. I was able to figure out that that this can be enabled by modified %USERPROFILE%\Documents\IISExpress\config\applicationhost.config
file, changing the value of the //configuration/system.applicationHost/sites/site/bindings/binding[@bindingInformation]
attribute from *:1728:localhost
to *:1728:*
.
This works, but there's another annoying problem: Whenever I reopen the project in Visual Studio, a duplicate site
element is created in the applicationHost.config
file with the old value of *:1728:localhost
for the bindingInformation
attribute, meaning I have to repeat the above process. Is there a way to get IIS Express/Visual Studio to use the existing, modified site
configuration element rather than create a new one? Failing that, is there a way to change the default value for the bindingInformation
attribute to *:1728:localhost
instead of *:1728:localhost
?
Upvotes: 5
Views: 931
Reputation: 138
Do not change the bindingInformation
in the already created bindings. Just add a new binding
element. Like so:
<site name="SitenameHere" id="11">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\**usernameHere**\PathToProjectHere" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:1728:localhost" />
<binding protocol="http" bindingInformation="*:1728:*" />
</bindings>
</site>
Upvotes: 0
Reputation: 41
Do not remove localhost from :1728:localhost. Just duplicate :1728:localhost; :1728:192.168.1.1
Upvotes: 4