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

时间:2016-03-18 23:15:02

标签: c# permissions owin

我有一个使用Owin自主功能的应用程序。

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

[#<PgSearch::Document id: 17, content: "nadja kuhn", searchable_id: 122, searchable_type: "Event", created_at: "2016-03-18 22:45:02", updated_at: "2016-03-18 22:45:02">, #<PgSearch::Document id: 19, content: "Zwischen Nadja Dazwischen", searchable_id: 124, searchable_type: "Event", created_at: "2016-03-18 22:45:02", updated_at: "2016-03-18 22:45:02">] 

我需要提供启动选项,否则会收到HTTP 503错误(请参阅here

以常规用户(非管理员)

运行时,这是例外
var options = new StartOptions
{
    ServerFactory = "Microsoft.Owin.Host.HttpListener"
};
options.Urls.Add("http://+:3579/");

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

内部异常: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()

0 个答案:

没有答案
相关问题