piers7
piers7

Reputation: 4404

Why does Nancy need URLACL for localhost, when OWIN-self-host doesn't?

Confused (again) by http url reservations in .Net, and when they are/aren't required.

I created a 'hello world' .net 4.5 console app, configured it to host a basic service on http://localhost:9001, and ran as non-admin.

When the service is hosted with Nancy self-host, it fails and says it needs a URL reservation (netsh http add http://localhost:9001 etc...)

However, if the service is hosted with Nancy-hosted-in-OWIN, using OWIN self-host, no such URL reservation is apparently required for localhost uris.

What gives? Is the error coming from Nancy spurious (perhaps a false positive on a config check designed to guide into pit of success), or does Nancy self-host use a different set of APIs from OWIN self-host that's (somehow) more fussy?

(NB: I know a reservation is required for http://+:port and http://some.ip:port reservations, I'm trying to work out why http://localhost:port behavior seems to vary)

Upvotes: 4

Views: 1183

Answers (1)

loreggia
loreggia

Reputation: 308

As documented here https://github.com/NancyFx/Nancy/wiki/Self-Hosting-Nancy the default behaviour is to rewrite "http://localhost:port" to http://+:port, you can disable this by passing in a

new HostConfiguration { RewriteLocalhost = false }

Upvotes: 5

Related Questions