ASP.NET Ubuntu Microsoft.AspNetCore.Identity.UI 3.1 的核心 3.1 问题
ASP.NET Core 3.1 issue with Microsoft.AspNetCore.Identity.UI 3.1 on Ubuntu
我的 .net core 3.1 网络应用 运行 在 Ubuntu 20.04.1 LTS 上正常运行。
直到我搭建了 Microsoft v1.0 的 Identity。
当我在项目文件夹中执行 sudo dotnet run
时,一切都按预期工作。
但是..当我通过我的服务执行此操作时,出现以下错误。
Dec 14 19:07:12 app systemd[1]: Started Web.App.
Dec 14 19:07:13 app web-app.service[9268]: Unhandled exception. System.IO.DirectoryNotFoundException: /root/.nuget/packages/microsoft.aspnetcore.identity.ui/3.1.10/staticwebassets/V4/
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsFileProvider..ctor(String pathPrefix, String contentRoot)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__2_0(ContentRootMapping cr)
Dec 14 19:07:13 app web-app.service[9268]: at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
Dec 14 19:07:13 app web-app.service[9268]: at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
Dec 14 19:07:13 app web-app.service[9268]: at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
Dec 14 19:07:13 app web-app.service[9268]: at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.WebHost.<>c.<ConfigureWebDefaults>b__9_0(WebHostBuilderContext ctx, IConfigurationBuilder cb)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass8_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.Hosting.HostBuilder.Build()
Dec 14 19:07:13 app web-app.service[9268]: at app.Web.Program.Main(String[] args) in /var/www/app/Program.cs:line 13
Dec 14 19:07:13 app systemd[1]: web-app.service: Main process exited, code=dumped, status=6/ABRT
Dec 14 19:07:13 app systemd[1]: web-app.service: Failed with result 'core-dump'.
Dec 14 19:07:19 app systemd[1]: Stopped Web.App.
有什么想法吗?
对于遇到同样问题的任何人,这是我的核心版本:
.NET Core SDK:
Version: 3.1.404
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.404/
Host (useful for support):
Version: 3.1.10
Commit: 1721e39439
.NET Core SDKs installed:
3.1.404 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
我尝试了以下方法:
- 我已经安装了所有与 Razor 相关的包 运行time - 没有帮助。
- 我已经安装了与 AspNetCore Identity 相关的所有软件包 - 没有帮助。
- 重新创建服务 - 没有用。
- 清理、重建、全部删除、从 git 中清理获取等等 - 没有任何效果。
- 所有 ubuntu 包都是最新的。 0 次更新。以防万一.. - 没有帮助。
我的问题出在服务 ExecStart 路径..(发布文件夹)
原来的ExecStart,
ExecStart=/usr/bin/dotnet /var/www/app/web-app/bin/Debug/netcoreapp3.1/web-app.dll
添加发布文件夹后,它按预期工作。
ExecStart=/usr/bin/dotnet /var/www/app/web-app/bin/Debug/netcoreapp3.1/publish/web-app.Web.dll
问题是我有相同的服务器,所有内容的版本都完全相同。我以完全相同的方式搭建了 Identity,它目前 运行 在没有发布文件夹的情况下完美无缺。
有趣的是,我从文件夹中 运行 dotnet 成功,但是当我从服务中 运行 它时,它会抱怨它。
我的 .net core 3.1 网络应用 运行 在 Ubuntu 20.04.1 LTS 上正常运行。
直到我搭建了 Microsoft v1.0 的 Identity。
当我在项目文件夹中执行 sudo dotnet run
时,一切都按预期工作。
但是..当我通过我的服务执行此操作时,出现以下错误。
Dec 14 19:07:12 app systemd[1]: Started Web.App.
Dec 14 19:07:13 app web-app.service[9268]: Unhandled exception. System.IO.DirectoryNotFoundException: /root/.nuget/packages/microsoft.aspnetcore.identity.ui/3.1.10/staticwebassets/V4/
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsFileProvider..ctor(String pathPrefix, String contentRoot)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__2_0(ContentRootMapping cr)
Dec 14 19:07:13 app web-app.service[9268]: at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
Dec 14 19:07:13 app web-app.service[9268]: at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
Dec 14 19:07:13 app web-app.service[9268]: at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
Dec 14 19:07:13 app web-app.service[9268]: at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.WebHost.<>c.<ConfigureWebDefaults>b__9_0(WebHostBuilderContext ctx, IConfigurationBuilder cb)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass8_0.<ConfigureAppConfiguration>b__0(HostBuilderContext context, IConfigurationBuilder builder)
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
Dec 14 19:07:13 app web-app.service[9268]: at Microsoft.Extensions.Hosting.HostBuilder.Build()
Dec 14 19:07:13 app web-app.service[9268]: at app.Web.Program.Main(String[] args) in /var/www/app/Program.cs:line 13
Dec 14 19:07:13 app systemd[1]: web-app.service: Main process exited, code=dumped, status=6/ABRT
Dec 14 19:07:13 app systemd[1]: web-app.service: Failed with result 'core-dump'.
Dec 14 19:07:19 app systemd[1]: Stopped Web.App.
有什么想法吗?
对于遇到同样问题的任何人,这是我的核心版本:
.NET Core SDK:
Version: 3.1.404
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.404/
Host (useful for support):
Version: 3.1.10
Commit: 1721e39439
.NET Core SDKs installed:
3.1.404 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
我尝试了以下方法:
- 我已经安装了所有与 Razor 相关的包 运行time - 没有帮助。
- 我已经安装了与 AspNetCore Identity 相关的所有软件包 - 没有帮助。
- 重新创建服务 - 没有用。
- 清理、重建、全部删除、从 git 中清理获取等等 - 没有任何效果。
- 所有 ubuntu 包都是最新的。 0 次更新。以防万一.. - 没有帮助。
我的问题出在服务 ExecStart 路径..(发布文件夹)
原来的ExecStart,
ExecStart=/usr/bin/dotnet /var/www/app/web-app/bin/Debug/netcoreapp3.1/web-app.dll
添加发布文件夹后,它按预期工作。
ExecStart=/usr/bin/dotnet /var/www/app/web-app/bin/Debug/netcoreapp3.1/publish/web-app.Web.dll
问题是我有相同的服务器,所有内容的版本都完全相同。我以完全相同的方式搭建了 Identity,它目前 运行 在没有发布文件夹的情况下完美无缺。
有趣的是,我从文件夹中 运行 dotnet 成功,但是当我从服务中 运行 它时,它会抱怨它。