gpt4 book ai didi

asp.net-core - .Net Core AspNetCoreHostingModel 是什么意思?

转载 作者:行者123 更新时间:2023-12-02 19:49:52 27 4
gpt4 key购买 nike

通过此链接,您可以了解 ASP.NET Core 模块

To configure an app for in-process hosting, add the property to the app's project file with a value of InProcess (out-of-process hosting is set with OutOfProcess)

读了好几遍了,还是不明白什么意思?

什么时候必须使用 OutOfProcess,什么时候必须使用 InProcess?

这些模型的优缺点?

做决定时依据什么?

最佳答案

指的是 IIS 如何托管您的应用程序 (web.config)。

InProcess:IIS 托管应用程序(w3wp.exe 或 iisexpress.exe)

OutOfProcess:Kestrel 托管应用程序,IIS 是 Kestrel 的代理。

更多 details关于如何配置以及使用时要记住的事项。

根据Microsoft,“InProcess”具有显着更好的性能.

要配置InProcess,请添加 Web 配置:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
<environmentVariables />
</aspNetCore>
</system.webServer>
</location>
</configuration>

对于进程外:

<?xml version="1.0" encoding="utf-8"?>
configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess">
<environmentVariables />
</aspNetCore>
</system.webServer>
</location>
</configuration>

当您在 my-api 文件夹中生成构建或通过以下方式简单发布到您的服务器时:

dotnet publish -o my-api -c release

我们会注意您的 %LAUNCHER_PATH% 和 %LAUNCHER_ARGS%。

您在最初的问题中提到的可能是关于 .csproj 配置,它决定应用程序如何在本地运行,默认为 InProcess

关于asp.net-core - .Net Core AspNetCoreHostingModel 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55762322/

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