首页 > 解决方案 > 从 netcore2.2 到 netcore3.0 的迁移项目

问题描述

我在 netcore2.2 中有一个 Identity Server 4 项目现在我想迁移到 netcore3.0 我已经安装了 sdk 托管包等等...在 appsetting 更改目标框架中更改版本 sdk 如果我编译告诉我好的但是.. .

我的旧 startup.cs 在 ConfigureService 中有这个调用:

services.AddMvc(options => options.Filters.Add(new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build())))
                .AddJsonOptions(options => 
                {
                    options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Include;
                    options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
                });

和 netcore 3.0 告诉我 options.SerializerSettings.DefaultValueHandling 和 options.SerializerSettings.NullValueHandling

它们不被认为是有效的

所以我拿出来......另一个问题是,当使用调试时看到不同的步骤,这个调用中的断点不会进入'

services.AddDbContext<DBPLATFORMContext>(options =>
{
                options.UseSqlServer(connectionString,
                                                 sqlServerOptionsAction: sqlOptions =>
                                                 {
                                                     sqlOptions.EnableRetryOnFailure(maxRetryCount: 5,
                                               maxRetryDelay: TimeSpan.FromSeconds(30),
                                               errorNumbersToAdd: null);
                                                 });
});

当我开始我的索引页时

在“配置”中

app.Use(async (context, next) => {
                await next();
                if (context.Response.StatusCode == 404 &&
                   !Path.HasExtension(context.Request.Path.Value) &&
                   !context.Request.Path.Value.StartsWith("/api/"))
                {
                    context.Request.Path = "/index.html";
                    await next();
               });

变量上下文给我响应 404 并且内容类型为空

你可以帮帮我吗?谢谢

标签: c#asp.net-coresdkmigration

解决方案


推荐阅读