将 ASP.NET Core 5.0 IdentityServer4 升级到 6.0 错误 - 没有这样的 table:密钥
Upgrading ASP.NET Core 5.0 IdentityServer4 to 6.0 error - no such table: Keys
将带有 IdentityServer4 的 Core 5.0 升级到 6.0 后 ASP.NET 错误 - 没有这样的 table:密钥
14:50:02.0033786|Failed executing DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "k"."Id", "k"."Algorithm", "k"."Created", "k"."Data", "k"."DataProtected", "k"."IsX509Certificate", "k"."Use", "k"."Version"
FROM "Keys" AS "k"
WHERE "k"."Use" = 'signing'
14:50:02.0179085|An exception occurred while iterating over the results of a query for context type 'xx.com.Data.AppDbContext'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such table: Keys'.
我找不到任何关于 IdentityServer 从 .net 5 迁移到 6 的文档
编辑 当您将 ID4 从 .NET Core 5 升级到 6 时,它会变成 Duende 服务器。 .NET 6 没有 ID4..
解决此问题的快速方法 (sqlite):
CREATE TABLE Keys (
Id TEXT NOT NULL
CONSTRAINT PK_Keys PRIMARY KEY,
Version INTEGER NOT NULL,
Created TEXT NOT NULL,
Use TEXT,
Algorithm TEXT NOT NULL,
IsX509Certificate INTEGER NOT NULL,
DataProtected INTEGER NOT NULL,
Data TEXT NOT NULL
);
CREATE INDEX IX_Keys_Use ON Keys (
"Use"
);
CREATE INDEX sqlite_autoindex_Keys_1 ON Keys (
Id COLLATE BINARY
);
禁用通过数据库管理证书(Table 'Keys' 不存在)。您可以继续从任何其他可用来源加载证书。
services.AddIdentityServer(options => {
options.KeyManagement.Enabled = false;
})
这是键的正确架构 table
CREATE TABLE Keys (
Id nvarchar(450) NOT NULL CONSTRAINT PK_Keys PRIMARY KEY,
Version INTEGER NOT NULL,
Created datetime2 NOT NULL,
[Use] nvarchar(450),
Algorithm nvarchar(100) NOT NULL,
IsX509Certificate INTEGER NOT NULL,
DataProtected INTEGER NOT NULL,
Data nvarchar(Max) NOT NULL
);
CREATE INDEX IX_Keys_Use ON Keys (
[Use]
);
CREATE INDEX sqlite_autoindex_Keys_1 ON Keys (
Id
);
将带有 IdentityServer4 的 Core 5.0 升级到 6.0 后 ASP.NET 错误 - 没有这样的 table:密钥
14:50:02.0033786|Failed executing DbCommand (4ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "k"."Id", "k"."Algorithm", "k"."Created", "k"."Data", "k"."DataProtected", "k"."IsX509Certificate", "k"."Use", "k"."Version"
FROM "Keys" AS "k"
WHERE "k"."Use" = 'signing'
14:50:02.0179085|An exception occurred while iterating over the results of a query for context type 'xx.com.Data.AppDbContext'.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'no such table: Keys'.
我找不到任何关于 IdentityServer 从 .net 5 迁移到 6 的文档
编辑 当您将 ID4 从 .NET Core 5 升级到 6 时,它会变成 Duende 服务器。 .NET 6 没有 ID4..
解决此问题的快速方法 (sqlite):
CREATE TABLE Keys (
Id TEXT NOT NULL
CONSTRAINT PK_Keys PRIMARY KEY,
Version INTEGER NOT NULL,
Created TEXT NOT NULL,
Use TEXT,
Algorithm TEXT NOT NULL,
IsX509Certificate INTEGER NOT NULL,
DataProtected INTEGER NOT NULL,
Data TEXT NOT NULL
);
CREATE INDEX IX_Keys_Use ON Keys (
"Use"
);
CREATE INDEX sqlite_autoindex_Keys_1 ON Keys (
Id COLLATE BINARY
);
禁用通过数据库管理证书(Table 'Keys' 不存在)。您可以继续从任何其他可用来源加载证书。
services.AddIdentityServer(options => {
options.KeyManagement.Enabled = false;
})
这是键的正确架构 table
CREATE TABLE Keys (
Id nvarchar(450) NOT NULL CONSTRAINT PK_Keys PRIMARY KEY,
Version INTEGER NOT NULL,
Created datetime2 NOT NULL,
[Use] nvarchar(450),
Algorithm nvarchar(100) NOT NULL,
IsX509Certificate INTEGER NOT NULL,
DataProtected INTEGER NOT NULL,
Data nvarchar(Max) NOT NULL
);
CREATE INDEX IX_Keys_Use ON Keys (
[Use]
);
CREATE INDEX sqlite_autoindex_Keys_1 ON Keys (
Id
);