3

I am trying to integrate nancy self hosting into my wpf project and when I start my program, I am able to connect to rest api from local browser, but cannot connect from another computer.

HostConfiguration hostConfigs = new HostConfiguration();
hostConfigs.UrlReservations.CreateAutomatically = true;

NancyHost host = new NancyHost(hostConfigs, new Uri("http://localhost:1234"));
host.Start();

Is there a way I can set Uri to wildcard, like in other built in web servers, 0.0.0.0 or + ?

EDIT Windows firewall is disabled!! I've also tried with different configurations of host, with http://10.10.10.149:1234" as a host. I've tryed "http://+:1234, this one doesn't build, it throws error.

I've also completely removed hostConfigs and added ACL to the system by running some commands in powershell, like suggested in many articles:

netsh http add urlacl url="http://+:12345/" user="Everyone"

Still, can only connect from local browser, not from another network location. Whenever I try to connect to machine where program is running via rest api, I get 503 Service Unavailable.

mason
  • 31,774
  • 10
  • 77
  • 121

2 Answers2

0

You will need to change it to "http://+:1234" to bind to all network interfaces.

Sifiso Shezi
  • 486
  • 2
  • 6
0

I have faced with a similar problem. I searched a lot of discussions and I had no answer. Then I found previous messages. I worked for me.

It was a firewall issue. And the solution;

1- Go to firewall settings 2- Inbound firewall rules 3- Add a new rule 4- Connection point (TCP / UDP) 5- TCP 6- (Enter port numbers) 7- Allow connection

I have shared my experience in case anyone need it.

uuuu
  • 1
  • 1