IISExpress returns a 503 error from remote machines
I'm attempting to test a website I have running in a local IISExpress instance with some other machines / devices on my local network. I am running Win7 Pro.
When I first attempt to browse to my machine from another machine on my local network segment, I get a 400 error: Hostname is invalid.
I understand that I need to grant remote access to the ACL with a command on the elevated command prompt like:
netsh http add urlacl url=http://mymachinename:50333/ user=everyone
Now I get a 503 service is unavailable error.
Windows Firewall is currently shut off, and I am able to browse my local IISExpress instance with the address http://localhost:50333
What is the final piece to this configuration puzzle?
It looks like you are missing a binding information entry in applicationhost.config file.
Open your applicationhost.config file. Possible locations are:
%userprofile%DocumentsIISExpressconfigapplicationhost.config
$(solutionDir).vsconfigapplicationhost.config
(VS2015) iisexpress.exe
to be sure. Locate your WebSite entry and add following binding with your machine name.
<binding protocol="http" bindingInformation=":50333:your-machine-name" />
Restart IIS Express
There was only 1 thing that worked for me.
using *:portnumber:*
was no good. Yes, after doing that and making sure the Windows Firewall was open, I could connect to the port, but I still got the "503" error.
I tested a few things locally, and discovered that only http://localhost worked. Using the real IP address (not 127.0.0.1, but, for instance, 192.168.1.50), still returned a 503 even on the local machine. I tried using the real host name in the bindings, but IIS Express refused to start. This may actually have something to do with how the host name was being resolved. I didn't explore that further.
Finally, I ended up using this configuration:
<binding protocol="http" bindingInformation="*:53351:localhost" />
<binding protocol="http" bindingInformation="192.168.1.50:53351:*" />
In that way, I was able to connect from a remote machine using http://192.168.1.50:53351
.
After wasting more than 3h on such a full subject I decided to share my setup with you. My configuration is Visual Express 2012 for Web update 4 on windows 8. This was my first come back to MS VS since studies (at least 8 years) and now I'm sure that linux rules. On django this kind of setup took me 10min of searching documentation.
turn off firewall for testing
netsh advfirewall set allprofiles state off
setup bindings in my case local address is localIP=192.168.1.102 (because links can not contain nonnumeric domain, use it below instead of mylocaldomain.com, see stackoverflow policy) in DocumentsIISExpressconfigapplicationhost.config
<bindings>
<binding protocol="http" bindingInformation="*:53351:mylocaldomain.com" />
<binding protocol="http" bindingInformation="*:53351:localhost" />
</bindings>
add autorun for ISS Express start service automatically
<site name="NeuronCharts" id="2" serverAutoStart="true">
Add some weird rules to http server (I still do not know if this is nesseary)
netsh http add urlacl url=http://mylocaldomain.com:53351/ user=everyone
run IISExpress manually not from VS IDE
http://mylocaldomain.com:53351
if it is working then we can add firewall rule add firewall rule
netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=53351 remoteip=any action=allow
set remoteip to any if you want to access you server from outside world if you want to access for local network use localsubnet
start firewall
netsh advfirewall set allprofiles state on
check again if everything is working on local and public ip
Wish you luck
Rafal
链接地址: http://www.djcxy.com/p/68722.html上一篇: IIS 7.5客户端证书身份验证