Please either enable UrlReservations.CreateAutomatically on the HostConfiguration provided to the……

代码如下:

var config = new HostConfiguration();
nancySelfHost = new NancyHost(config, new Uri(url));
nancySelfHost.Start();

在部分电脑上出现如下报错:

The Nancy self host was unable to start, as no namespace reservation existed for the provided url(s).

Please either enable UrlReservations.CreateAutomatically on the HostConfiguration provided to 
the NancyHost, or create the reservations manually with the (elevated) command(s):

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

解决,代码改成如下:

var config = new HostConfiguration
{
    UrlReservations = new UrlReservations() { CreateAutomatically = true }
};
nancySelfHost = new NancyHost(config, new Uri(url));
nancySelfHost.Start();

你可能感兴趣的:(C#,服务器,c#)