gpt4 book ai didi

.net - Asp .net 核心 httpssys 异常 - 访问被拒绝

转载 作者:行者123 更新时间:2023-12-05 07:24:39 29 4
gpt4 key购买 nike

我无法找到正确的权限来授予域服务帐户以能够运行我的 api(作为 Windows 服务)。

我可能遗漏了一些东西,所以任何帮助将不胜感激:)

我用 netsh 注册了正确的 url。我可以使用我的用户帐户(类似于管理员)运行该服务。如果我收听http://localhost:28000/public/v1/,我就可以运行该服务但不使用端口 localhost:80 或除 localhost 以外的任何其他端口。我在 Administrators 组中添加了我的服务帐户,同样的错误。

我正在使用运行 Windows Server 2016 Standard 的虚拟机。域已配置,我是该域中唯一的计算机。

谢谢

这是完整的堆栈跟踪:

info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using 'C:\Users_esbapi\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. info: Microsoft.AspNetCore.Server.HttpSys.HttpSysListener[0] Start info: Microsoft.AspNetCore.Server.HttpSys.HttpSysListener[0] Listening on prefix: http://localhost:80/public/v1/ fail: Microsoft.AspNetCore.Server.HttpSys.HttpSysListener[0] Start Microsoft.AspNetCore.Server.HttpSys.HttpSysException (0x80004005): Access is denied at Microsoft.AspNetCore.Server.HttpSys.UrlGroup.RegisterPrefix(String uriPrefix, Int32 contextId) at Microsoft.AspNetCore.Server.HttpSys.UrlPrefixCollection.RegisterAllPrefixes(UrlGroup urlGroup) at Microsoft.AspNetCore.Server.HttpSys.HttpSysListener.Start()

Unhandled Exception: Microsoft.AspNetCore.Server.HttpSys.HttpSysException: Access is denied at Microsoft.AspNetCore.Server.HttpSys.UrlGroup.RegisterPrefix(String uriPrefix, Int32 contextId) at Microsoft.AspNetCore.Server.HttpSys.UrlPrefixCollection.RegisterAllPrefixes(UrlGroup urlGroup) at Microsoft.AspNetCore.Server.HttpSys.HttpSysListener.Start() at Microsoft.AspNetCore.Server.HttpSys.MessagePump.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken) at Microsoft.AspNetCore.Hosting.Internal.WebHost.d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.WebHostExtensions.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at EventsServiceHost.StartConsole() in EventsServiceHost.cs:line 22
at Program.Main(String[] args) in Program.cs:line 38

最佳答案

这是一个回复,以防其他人遇到这个问题。

netsh http add urlacl url=https://DNSALIAS:PORT/ user=DOMAIN\SERVICEACCOUNT

假设:

  • 您已创建指向运行服务的主机的 DNS 条目
  • PORT 已绑定(bind)到主机 DNS 条目
  • 服务帐户是在 AD 中创建的

如果服务已经绑定(bind)到另一个端口,您需要先发出删除命令

netsh http delete urlacl url=https://DNSALIAS:PORT/

还要确保您的服务帐户有权在将要运行的环境中写入日志文件。

关于.net - Asp .net 核心 httpssys 异常 - 访问被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55281977/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com