我的应用程序使用Nancy Selfhosting.当我在没有管理员权限的情况下启动它时,我得到一个System.Net.HttpListenerException"Access Denied".
这是代码:
static void Main(string[] args)
{
var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:80/"));
nancyHost.Start();
Application.Run();
}
Run Code Online (Sandbox Code Playgroud)
我也试过不同的端口但没有成功.奇怪的是,在启动侦听同一个Url的HttpListener时,我没有得到任何异常.可能导致此异常的原因是什么?