为什么.NET6自我含糊的应用程序太慢?

发布于 2025-02-04 11:49:24 字数 1079 浏览 2 评论 0原文

我在.net6中有应用程序,我的部署经理需要它们作为独立的。因此,我已将YAML构建命令更改为以下:

- task: DotNetCoreCLI@2
  displayName: Publish service
  inputs:
    command: publish
    projects: <my project>.csproj
    publishWebProjects: True
    arguments: '--self-contained true --configuration $(BuildConfiguration) --no-restore --output "$(Build.ArtifactStagingDirectory)\service" -p:Version=$(GitVersion.FullSemVer) /p:DebugType=None /p:PublishTrimmed=true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:InformationalVersion=$(GitVersion.InformationalVersion)'
    zipAfterPublish: false

在项目文件中,添加了新元素:

<RuntimeIdentifier>win10-x64</RuntimeIdentifier>

和AppSettings.json文件添加了元素:

<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>

真正产生了一个“单个文件”部署(仅文件:Microsoft.data.sqlclient.sni .pdb位于旁边)。

但是,该应用程序需要大约30分钟!?与非固有的部署相比,反应速度慢了1000倍

有什么问题?请问如何诊断?

感谢您的回答,PETR

I have app in .NET6, my deployment manager needs them as a self-contained. So, I have changed YAML build command to following:

- task: DotNetCoreCLI@2
  displayName: Publish service
  inputs:
    command: publish
    projects: <my project>.csproj
    publishWebProjects: True
    arguments: '--self-contained true --configuration $(BuildConfiguration) --no-restore --output "$(Build.ArtifactStagingDirectory)\service" -p:Version=$(GitVersion.FullSemVer) /p:DebugType=None /p:PublishTrimmed=true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:InformationalVersion=$(GitVersion.InformationalVersion)'
    zipAfterPublish: false

In project file there are added new elements:

<RuntimeIdentifier>win10-x64</RuntimeIdentifier>

and appsettings.json files have added elements:

<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>

There is really produced a "single file" deployment (only file: Microsoft.Data.SqlClient.SNI.pdb lies next to).

But starting of the app takes ~ 30 minutes!? Reactions are 1000 times slower in comparation with non-self-contained deployment

What's wrong? How to diagnose it please?

Thanks for your answers, Petr

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文