Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么Owin.Hosting.StartOptions需要管理员权限?_C#_Permissions_Owin - Fatal编程技术网

C# 为什么Owin.Hosting.StartOptions需要管理员权限?

C# 为什么Owin.Hosting.StartOptions需要管理员权限?,c#,permissions,owin,C#,Permissions,Owin,我有一个应用程序正在利用Owin的自主机功能 该应用程序不需要管理员权限,但当我使用以下代码时,如果它不是以管理员身份运行,则会由于“拒绝访问”而引发异常 var options = new StartOptions { ServerFactory = "Microsoft.Owin.Host.HttpListener" }; options.Urls.Add("http://+:3579/"); using (WebApp.Start<Startup>(options))

我有一个应用程序正在利用Owin的自主机功能

该应用程序不需要管理员权限,但当我使用以下代码时,如果它不是以管理员身份运行,则会由于“拒绝访问”而引发异常

var options = new StartOptions
{
    ServerFactory = "Microsoft.Owin.Host.HttpListener"
};
options.Urls.Add("http://+:3579/");

using (WebApp.Start<Startup>(options)) { // ..  } 

内部异常:
访问被拒绝

我想(未测试)这是因为在Windows上,Owin会转到HttpListener:“修改命名空间某部分的保留权限需要管理权限或命名空间该部分的所有权。最初,整个HTTP命名空间属于本地管理员。“。另请参见URL覆盖端口。你确定这不是防火墙问题吗?这100%不是防火墙issue@SimonMourier是的,这就是应用程序需要该名称空间所有权的问题,如果我添加URL保留,问题就会消失。谢谢你的帮助。你看过源代码了吗?
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuilder builder)
at Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(StartContext context)
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start[TStartup](StartOptions options)
at PlexRequests.UI.Program.Main(String[] args) in C:\Users\Jamie\Documents\GitHubVisualStudio\PlexRequests.Net\PlexRequests.UI\Program.cs:line 93
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()