gpt4 book ai didi

c# - ASP .Net Core 2 自包含部署在不同应用程序池标识帐户下的 IIS 中出现 502.5 错误

转载 作者:太空宇宙 更新时间:2023-11-03 14:50:57 24 4
gpt4 key购买 nike

我有一个面向 netcoreapp2.1 的 ASP .Net Core 2 Web Api 应用程序并作为独立的(生成一个 exe)部署到 IIS。

在此服务器上,该应用程序将与配置为在特定 AD 帐户下运行的现有应用程序池一起工作。

当我们将其更改为使用与第一个帐户似乎对文件夹具有相同权限的不同帐户时,应用程序将无法启动并出现 502.5 错误。

enter image description here

这是真正奇怪的部分。如果我们运行另一个指向同一个应用程序文件夹的站点,但在第一个 AD 帐户下它工作然后使用第二个 AD 帐户运行该站点,它现在可以正常工作。

另一点信息,应用程序文件的物理位置在网络共享上。当我们将物理文件移动到 IIS 服务器(以在本地运行它)时它会工作,但由于我们的企业设置,这不是生产中的一个选项。因此,它似乎与使用 UNC 文件路径从网络共享启动 exe 的某种权限/策略有关。

更新这些文件是从 NAS 而非 Windows Server 共享共享的。此外,我已经确定对于用户来说,这对于应用程序报告它在 Internet 区域中运行而失败,而另一个用户在 Intranet 区域中运行。

这些区域是如何确定的?

下面是失败时的标准输出日志。

Unhandled Exception: System.Net.Sockets.SocketException: An invalid argument was supplied
at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass22_0`1.<<StartAsync>g__OnBind|0>d.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.Server.Kestrel.Core.Internal.AddressBinder.<BindEndpointAsync>d__3.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.Server.Kestrel.Core.ListenOptions.<BindAsync>d__43.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.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.<BindAsync>d__2.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.Server.Kestrel.Core.Internal.AddressBinder.<BindAsync>d__0.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.Server.Kestrel.Core.KestrelServer.<StartAsync>d__22`1.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.Internal.WebHost.<StartAsync>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.<RunAsync>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.<RunAsync>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 MyApp.Program.Main(String[] args)

最佳答案

要解决此问题,您需要将网站/项目发布为独立的应用程序。为了将其发布为独立的应用程序,请将其添加到 csproj 文件夹中。

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<RuntimeIdentifiers>win7-x64;win7-x86;ubuntu.16.04-x64;</RuntimeIdentifiers>
<SuppressDockerTargets>True</SuppressDockerTargets>
</PropertyGroup>

希望对您有所帮助!

关于c# - ASP .Net Core 2 自包含部署在不同应用程序池标识帐户下的 IIS 中出现 502.5 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51768809/

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