Assuming your app server is IIS Express, it won′t work by default because of network restrictions or even the firewall.
First thing, as you already realized, the client needs to connect with your machine ip, not localhost. Something like http://x.x.x.x:port/signalr
Then you need to make sure your machine is accesible from the mobile phone or emulator: open a browser in the phone and type a known address, like http://x.x.x.x:port/somethingThatExists
.
If that url is not available:
- Try disabling the firewall
Open powershell at the machine runing IIS-Express and run this: netsh http add urlacl url=http://{your server ip}:{port}/ user=everyone
. (if your system language is not english, for instance: spanish, change "everyone" to "todos")
Open the file applicationhost.config
in your directory solution Solution/.vs/config/applicationhost.config
and search for the application xml node. Something like <site name="YourAppName" id="1">...</site>
. You′ll see the localhost
binding by default. Add a new one with the actual ip: <binding protocol="http" bindinginformation="*:port:x.x.x.x"></binding>
(make sure the ip/port are correct. i.e: *:57457:192.168.0.57
)
Restart IIS Express and try again (no need to reboot the system)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…