简体   繁体   English

升级到.net核心3.0

[英]Upgrading to .net core 3.0

We have recently upgraded our asp.net core 2.2 to 3.0 but cant figure out the problem we are having right now...我们最近将 asp.net 核心 2.2 升级到 3.0,但无法弄清楚我们现在遇到的问题......

When I start up the webproject, I get an exception on "MapControllers":当我启动 webproject 时,“MapControllers”出现异常:

ReflectionTypeLoadException: Unable to load one or more of the requested types. ReflectionTypeLoadException:无法加载一种或多种请求的类型。 Could not load type 'Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter' from assembly 'Microsoft.AspNetCore.Mvc.ViewFeatures, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.无法从程序集“Microsoft.AspNetCore.Mvc.ViewFeatures,版本=3.0.0.0,文化=中性,PublicKeyToken=adb9793829ddae60”加载类型“Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter”。

It looks like something is using SaveTempDataFilter from "Microsoft.AspNetCore.Mvc.ViewFeatures" that doesnt exists anymore, or am I wrong?看起来有些东西正在使用“Microsoft.AspNetCore.Mvc.ViewFeatures”中不再存在的SaveTempDataFilter,还是我错了?

Any help in the right direction is appreciated.感谢您在正确方向上的任何帮助。

      app.UseEndpoints(endpoints => {
                endpoints.MapControllers();
                endpoints.MapAreaControllerRoute("admin", "admin", "Admin/{controller}/{action=Index}/{id?}");
                endpoints.MapControllerRoute("default", "{controller=Schedule}/{action=Index}/{id?}");
            });

Program.cs程序.cs


          var host = Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder
                    .UseContentRoot(Directory.GetCurrentDirectory())
                    .UseKestrel((context, options) =>
                    {
                        options.AddServerHeader = false;
                    })
                    .UseIIS()
                    .UseIISIntegration()
                    .UseStartup<Startup>();
                })
                .Build();

            host.Run();

I found the problem.我发现了问题。

We where using a nuget package "AspNetCore.Mvc.CookieTempData" who tried to use something in "Microsoft.AspNetCore.Mvc.ViewFeatures" which did not exist anymore.我们使用 nuget package "AspNetCore.Mvc.CookieTempData" 试图在 "Microsoft.AspNetCore.Mvc.ViewFeatures" 中使用不再存在的东西。

Removing this package solved it.删除这个 package 解决了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM