|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
fkthat Ролг Хупин Как поменять ориентацию на PostgreSQL? Очевидно, что использовать вот это . Только учти, там по ссылке, походу, пример говеный. (Вместо переопределения в контексте OnConfiguring нужно просто делать конструктор с DbContextOptions, как обычно делают) Что имею: 1. сделал простейший пример с SqlServer, исправил строку коннекта, сделал логин - фигушки, регистер, потом логин - сработало! После логина - редиректнулось на ноум\индекс, в базе появились таблицы, в таблицах запись с юзером. 2. Добавил нугеты для постгреса, исправил строку коннекта, код изменил: Код: c# 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.
пускаю - коннектится к базе, но дальше какая-то мутная ошибка При этом - ладно таблица не существует, но EF должен бы сам создать и не выдавать ошибок. Что с этим делать? Может сутруктуру можно рукми сделать и не париться? где взять скрипт со структурой? Executing endpoint 'WebApplication1.Controllers.HomeController.Index (WebA pplication1)' info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "Index", controller = "Home", page = "", area = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.IAct ionResult Index() on controller WebApplication1.Controllers.HomeController (WebA pplication1). info: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[1] Executing ViewResult, running view Index. info: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[4] Executed ViewResult - view Index executed in 302.6169ms. info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action WebApplication1.Controllers.HomeController.Index (WebAppli cation1) in 315.3645ms info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'WebApplication1.Controllers.HomeController.Index (WebAp plication1)' info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 451.9255ms 200 text/html; charset=utf-8 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET https://localhost:5001/Identity/Account/Logi n info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint '/Account/Login' info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[3] Route matched with {page = "/Account/Login", area = "Identity", action = " ", controller = ""}. Executing page /Account/Login info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[101] Executing handler method Microsoft.AspNetCore.Identity.UI.V4.Pages.Account .Internal.LoginModel.OnGetAsync - ModelState is Valid info: Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler[11 ] AuthenticationScheme: Identity.External signed out. info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[102] Executed handler method OnGetAsync, returned result . info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[103] Executing an implicit handler method - ModelState is Valid info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[104] Executed an implicit handler method, returned result Microsoft.AspNetCore. Mvc.RazorPages.PageResult. info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4] Executed page /Account/Login in 104.6291ms info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint '/Account/Login' info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 157.5038ms 200 text/html; charset=utf-8 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 POST https://localhost:5001/Identity/Account/Log in application/x-www-form-urlencoded 264 info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint '/Account/Login' info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[3] Route matched with {page = "/Account/Login", area = "Identity", action = " ", controller = ""}. Executing page /Account/Login info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[101] Executing handler method Microsoft.AspNetCore.Identity.UI.V4.Pages.Account .Internal.LoginModel.OnPostAsync - ModelState is Valid info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 3.1.0 initialized 'ApplicationDbContext' using provi der 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: None fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (182ms) [Parameters=[@__normalizedUserName_0='? '], CommandType='Text', CommandTimeout='30'] SELECT a."Id", a."AccessFailedCount", a."ConcurrencyStamp", a."Email", a." EmailConfirmed", a."LockoutEnabled", a."LockoutEnd", a."NormalizedEmail", a."Nor malizedUserName", a."PasswordHash", a."PhoneNumber", a."PhoneNumberConfirmed", a ."SecurityStamp", a."TwoFactorEnabled", a."UserName" FROM "AspNetUsers" AS a WHERE a."NormalizedUserName" = @__normalizedUserName_0 LIMIT 1 fail: Microsoft.EntityFrameworkCore.Query[10100] An exception occurred while iterating over the results of a query for cont ext type 'WebApplication1.Data.ApplicationDbContext'. Npgsql.PostgresException (0x80004005): 42P01: relation "AspNetUsers" does not exist at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__Rea dMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown - -- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__Rea dMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown - -- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsumin g) at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Bo olean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavi or, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance llationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance llationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance llationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.As yncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationTok en cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecuti onStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 v erifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.As yncEnumerator.MoveNextAsync() Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "AspNetUsers" does not exist Position: 294 File: parse_relation.c Line: 1159 Routine: parserOpenTable Npgsql.PostgresException (0x80004005): 42P01: relation "AspNetUsers" does not ex ist at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, Ca ncellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync (RelationalCommandParameterObject parameterObject, CancellationToken cancellatio nToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync (RelationalCommandParameterObject parameterObject, CancellationToken cancellatio nToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync (RelationalCommandParameterObject parameterObject, CancellationToken cancellatio nToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnu merator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken can cellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStra tegy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifyS ucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnu merator.MoveNextAsync() Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "AspNetUsers" does not exist Position: 294 File: parse_relation.c Line: 1159 Routine: parserOpenTable info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4] Executed page /Account/Login in 2362.999ms info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint '/Account/Login' info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (18ms) [Parameters=[], CommandType='Text', CommandTimeo ut='30'] SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_name space n ON n.oid=c.relnamespace WHERE c.relname='__EFMigrationsHistory'); info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 3019.116ms 500 text/html; charset=utf-8 ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 15:31 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин но EF должен бы сам создать ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 16:05 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин, Пишет: ЛоггерMessageText: relation "AspNetUsers" does not exist БД, значит, не инициализирована. ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 16:27 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Shocker.Pro Ролг Хупин но EF должен бы сам создать то же приложение, работавшее с SqlServer все сделало само, структуру в базе, и продолжило работать. А когда настроил до постгреса такая ошибка. Делаю в студийной PM Console: автор> PM> Update-Database System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.ProductInfo' from assembly 'Microsoft.EntityFrameworkCore, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. at Microsoft.EntityFrameworkCore.Design.OperationExecutor..ctor(Object reportHandler, IDictionary args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language) at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor() at Microsoft.EntityFrameworkCore.Tools.Commands.DatabaseUpdateCommand.Execute() at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0() at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) Exception has been thrown by the target of an invocation. а в Powershell фолдере с прожектом: >dotnet ef database update Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET Core program, but dotnet-ef does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. P ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 16:38 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин то же приложение, работавшее с SqlServer все сделало само Если ты не вызовешь Migrate(), то само ничего не сделается Ролг Хупин * You misspelled a built-in dotnet command. ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 16:56 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Shocker.Pro Ролг Хупин то же приложение, работавшее с SqlServer все сделало само Если ты не вызовешь Migrate(), то само ничего не сделается Ролг Хупин * You misspelled a built-in dotnet command. пытаюсь делать по выданным инструкциям 1. сделал так в студии в PM console авторPM> dotnet tool install --global dotnet-ef You can invoke the tool using the following command: dotnet-ef Tool 'dotnet-ef' (version '3.1.0') was successfully installed. PM> Update-Database System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.ProductInfo' from assembly 'Microsoft.EntityFrameworkCore, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. at Microsoft.EntityFrameworkCore.Design.OperationExecutor..ctor(Object reportHandler, IDictionary args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language) at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor() at Microsoft.EntityFrameworkCore.Tools.Commands.DatabaseUpdateCommand.Execute() at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0() at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) Exception has been thrown by the target of an invocation. PM> Так в PowerShell: авторPS G:\MyProjects\WebApplication1> dotnet tool install --global dotnet-ef Tool 'dotnet-ef' is already installed. PS G:\MyProjects\WebApplication1> dotnet ef database update Build started... Build succeeded. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.ProductInfo' from assembly 'Microsoft.EntityFrameworkCore, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. at Microsoft.EntityFrameworkCore.Design.OperationExecutor..ctor(Object reportHandler, IDictionary args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language) at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor() at Microsoft.EntityFrameworkCore.Tools.Commands.DatabaseUpdateCommand.Execute() at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0() at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) Exception has been thrown by the target of an invocation. Что делаю не так? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:09 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
ошибка по ProductInfo гуглится, нам за тебя еще и ответы почитать? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:11 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Shocker.Pro ошибка по ProductInfo гуглится, нам за тебя еще и ответы почитать? не, сам почитаю, тут такое еще обнаружил: поставил клиента >dotnet tool install --global dotnet-ef Надо было еще выполнить команду >dotnet add package Microsoft.EntityFrameworkCore.Design Отработала, пустил, п-ц какой-то PS G:\MyProjects\WebApplication1> dotnet ef database update 42601: syntax error at or near "[" Build started... Build succeeded. info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 3.1.0 initialized 'ApplicationDbContext' using provider 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: None info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (11ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace WHERE c.relname='__EFMigrationsHistory'); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (28ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "__EFMigrationsHistory" ( "MigrationId" character varying(150) NOT NULL, "ProductVersion" character varying(32) NOT NULL, CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId") ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace WHERE c.relname='__EFMigrationsHistory'); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT "MigrationId", "ProductVersion" FROM "__EFMigrationsHistory" ORDER BY "MigrationId"; info: Microsoft.EntityFrameworkCore.Migrations[20402] Applying migration '00000000000000_CreateIdentitySchema'. Applying migration '00000000000000_CreateIdentitySchema'. info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (43ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetRoles" ( "Id" text NOT NULL, "Name" character varying(256) NULL, "NormalizedName" character varying(256) NULL, "ConcurrencyStamp" text NULL, CONSTRAINT "PK_AspNetRoles" PRIMARY KEY ("Id") ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (58ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetUsers" ( "Id" text NOT NULL, "UserName" character varying(256) NULL, "NormalizedUserName" character varying(256) NULL, "Email" character varying(256) NULL, "NormalizedEmail" character varying(256) NULL, "EmailConfirmed" boolean NOT NULL, "PasswordHash" text NULL, "SecurityStamp" text NULL, "ConcurrencyStamp" text NULL, "PhoneNumber" text NULL, "PhoneNumberConfirmed" boolean NOT NULL, "TwoFactorEnabled" boolean NOT NULL, "LockoutEnd" timestamp with time zone NULL, "LockoutEnabled" boolean NOT NULL, "AccessFailedCount" integer NOT NULL, CONSTRAINT "PK_AspNetUsers" PRIMARY KEY ("Id") ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (43ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetRoleClaims" ( "Id" integer NOT NULL, "RoleId" text NOT NULL, "ClaimType" text NULL, "ClaimValue" text NULL, CONSTRAINT "PK_AspNetRoleClaims" PRIMARY KEY ("Id"), CONSTRAINT "FK_AspNetRoleClaims_AspNetRoles_RoleId" FOREIGN KEY ("RoleId") REFERENCES "AspNetRoles" ("Id") ON DELETE CASCADE ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (48ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetUserClaims" ( "Id" integer NOT NULL, "UserId" text NOT NULL, "ClaimType" text NULL, "ClaimValue" text NULL, CONSTRAINT "PK_AspNetUserClaims" PRIMARY KEY ("Id"), CONSTRAINT "FK_AspNetUserClaims_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (67ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetUserLogins" ( "LoginProvider" character varying(128) NOT NULL, "ProviderKey" character varying(128) NOT NULL, "ProviderDisplayName" text NULL, "UserId" text NOT NULL, CONSTRAINT "PK_AspNetUserLogins" PRIMARY KEY ("LoginProvider", "ProviderKey"), CONSTRAINT "FK_AspNetUserLogins_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (60ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetUserRoles" ( "UserId" text NOT NULL, "RoleId" text NOT NULL, CONSTRAINT "PK_AspNetUserRoles" PRIMARY KEY ("UserId", "RoleId"), CONSTRAINT "FK_AspNetUserRoles_AspNetRoles_RoleId" FOREIGN KEY ("RoleId") REFERENCES "AspNetRoles" ("Id") ON DELETE CASCADE, CONSTRAINT "FK_AspNetUserRoles_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (49ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE TABLE "AspNetUserTokens" ( "UserId" text NOT NULL, "LoginProvider" character varying(128) NOT NULL, "Name" character varying(128) NOT NULL, "Value" text NULL, CONSTRAINT "PK_AspNetUserTokens" PRIMARY KEY ("UserId", "LoginProvider", "Name"), CONSTRAINT "FK_AspNetUserTokens_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (31ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE INDEX "IX_AspNetRoleClaims_RoleId" ON "AspNetRoleClaims" ("RoleId"); fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (16ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE UNIQUE INDEX "RoleNameIndex" ON "AspNetRoles" ("NormalizedName") WHERE [NormalizedName] IS NOT NULL; Failed executing DbCommand (16ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE UNIQUE INDEX "RoleNameIndex" ON "AspNetRoles" ("NormalizedName") WHERE [NormalizedName] IS NOT NULL; Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "[" at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0() at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action) Exception data: Severity: ERROR SqlState: 42601 MessageText: syntax error at or near "[" Position: 79 File: scan.l Line: 1086 Routine: scanner_yyerror 42601: syntax error at or near "[" ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:20 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Хм, попробуй удалить миграцию и создать её заново. Теоретически миграция (если только не пишешь SQL руками) не должна зависеть от СУБД Ты ведь вот это: "CREATE UNIQUE INDEX "RoleNameIndex" ON "AspNetRoles" ("NormalizedName") WHERE [NormalizedName] IS NOT NULL;" не руками писал? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:24 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Shocker.Pro Хм, попробуй удалить миграцию и создать её заново. Теоретически миграция (если только не пишешь SQL руками) не должна зависеть от СУБД Ты ведь вот это: "CREATE UNIQUE INDEX "RoleNameIndex" ON "AspNetRoles" ("NormalizedName") WHERE [NormalizedName] IS NOT NULL;" не руками писал? не, в этом прожекте я хотел обойтись без рукоблудия, как писал выше: сначала с Sql Server проверил, сработало, потом изменил на PostgreSQL и такая фигня прёт. Я уже бы создал руками эти таблицы, если бы оно дальше работало. Это о скобками похоже торчит в нугет пакете? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:35 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин потом изменил на PostgreSQL ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:37 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Shocker.Pro Ролг Хупин потом изменил на PostgreSQL какой командой? Когда на странице выдает Apply кнопку, жму , получаю такую ошибку. ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:39 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин какой командой? https://docs.microsoft.com/ru-ru/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:49 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин Shocker.Pro пропущено... попробуй для начала пересоздать миграцию какой командой? Когда на странице выдает Apply кнопку, жму , получаю такую ошибку. сделал >dotnet ef database update Начало работать и потом выдало ту же ошибку авторFailed executing DbCommand (12ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] CREATE UNIQUE INDEX "RoleNameIndex" ON "AspNetRoles" ("NormalizedName") WHERE [NormalizedName] IS NOT NULL; А где-то же есть исходные коды того, что в этом нугет пакете? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:51 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин, это ты так WinForms приложение на веб переводишь? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 17:52 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ты миграцию пересоздал? ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 18:06 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин, Ты похоже миграцию SQL Server-а пытаешься накатить на посгресс. Тебе надо их выкосить из проекта (папка Migrations) потом сгенерить заново для посгресса и накатить их. Но, пока ты еще не сильно в этом разобрался, то просто снеси имеющуюся БД, снеси на всякий случай миграции, и в коде вставь вызов EnsureDatabaseCreated() для контекста. ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 18:10 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
fkthat Ролг Хупин, Ты похоже миграцию SQL Server-а пытаешься накатить на посгресс. Тебе надо их выкосить из проекта (папка Migrations) потом сгенерить заново для посгресса и накатить их. Но, пока ты еще не сильно в этом разобрался, то просто снеси имеющуюся БД, снеси на всякий случай миграции, и в коде вставь вызов EnsureDatabaseCreated() для контекста. Такой папки нет Кстати, у них в коде Код: c# 1. 2. 3. 4.
... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 18:18 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
fkthat Ты похоже миграцию SQL Server-а пытаешься накатить на посгресс. Надо пересоздать миграцию и посмотреть, будет ли она отличаться ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 18:30 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин Такой папки нет Кстати, у них в коде ... |
|||
:
Нравится:
Не нравится:
|
|||
11.12.2019, 18:31 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
skyANA Ролг Хупин, это ты так WinForms приложение на веб переводишь? Не то чтобы перевожу, но практичеки надо сделать ASP.NET клиента, и соответственно сервер, база остается ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2019, 10:30 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Shocker.Pro Ты миграцию пересоздал? 1. был не прав, нашел в прожекте фолдер Data\Migration, там были файлы, может быть и похоже остались от SQL Server, грохнул весь фолдер 2. сделал в CMD > dotnet ef migrations add mig01 Build started... Build succeeded. info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 3.1.0 initialized 'ApplicationDbContext' using provider 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: None Done. To undo this action, use 'ef migrations remove' Появился фолдер Migrations с 3 файлами 3. Запустил приложение, на первом же логине получил экран с кнопкой A database operation failed while processing the request. PostgresException: 42P01: relation "AspNetUsers" does not exist Applying existing migrations for ApplicationDbContext may resolve this issue There are migrations for ApplicationDbContext that have not been applied to the database 20191212080541_mig01 Apply Migrations In Visual Studio, you can use the Package Manager Console to apply pending migrations to the database: PM> Update-Database Alternatively, you can apply pending migrations from a command prompt at your project directory: > dotnet ef database update Пишут, что это один из вариантов, нажал Apply Migrations, "An error occurred applying migrations, try applying them from the command line" 4.Сделал в CMD: > dotnet ef database update ================= ."SecurityStamp", a."TwoFactorEnabled", a."UserName" FROM "AspNetUsers" AS a WHERE a."NormalizedUserName" = @__normalizedUserName_0 LIMIT 1 fail: Microsoft.EntityFrameworkCore.Query[10100] An exception occurred while iterating over the results of a query for cont ext type 'WebApplication1.Data.ApplicationDbContext'. Npgsql.PostgresException (0x80004005): 42P01: relation "AspNetUsers" does not exist at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__Rea dMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown - -- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__Rea dMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown - -- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsumin g) at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Bo olean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavi or, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance llationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance llationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReade rAsync(RelationalCommandParameterObject parameterObject, CancellationToken cance llationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.As yncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationTok en cancellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecuti onStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 v erifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.As yncEnumerator.MoveNextAsync() Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "AspNetUsers" does not exist Position: 294 File: parse_relation.c Line: 1159 Routine: parserOpenTable Npgsql.PostgresException (0x80004005): 42P01: relation "AspNetUsers" does not ex ist at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, Ca ncellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync (RelationalCommandParameterObject parameterObject, CancellationToken cancellatio nToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync (RelationalCommandParameterObject parameterObject, CancellationToken cancellatio nToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync (RelationalCommandParameterObject parameterObject, CancellationToken cancellatio nToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnu merator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken can cellationToken) at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStra tegy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifyS ucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnu merator.MoveNextAsync() Exception data: Severity: ERROR SqlState: 42P01 MessageText: relation "AspNetUsers" does not exist Position: 294 File: parse_relation.c Line: 1159 Routine: parserOpenTable info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4] Executed page /Account/Login in 2246.33ms info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint '/Account/Login' info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (14ms) [Parameters=[], CommandType='Text', CommandTimeo ut='30'] SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_name space n ON n.oid=c.relnamespace WHERE c.relname='__EFMigrationsHistory'); info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 2885.6528ms 500 text/html; charset=utf-8 info: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 POST https://localhost:5001/ApplyDatabaseMigrati ons application/x-www-form-urlencoded 135 info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 3.1.0 initialized 'ApplicationDbContext' using provi der 'Npgsql.EntityFrameworkCore.PostgreSQL' with options: None info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeou t='30'] SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_name space n ON n.oid=c.relnamespace WHERE c.relname='__EFMigrationsHistory'); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (26ms) [Parameters=[], CommandType='Text', CommandTimeo ut='30'] CREATE TABLE "__EFMigrationsHistory" ( "MigrationId" character varying(150) NOT NULL, "ProductVersion" character varying(32) NOT NULL, CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId") ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeou t='30'] SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_name space n ON n.oid=c.relnamespace WHERE c.relname='__EFMigrationsHistory'); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (2ms) [Parameters=[], CommandType='Text', CommandTimeou t='30'] SELECT "MigrationId", "ProductVersion" FROM "__EFMigrationsHistory" ORDER BY "MigrationId"; info: Microsoft.EntityFrameworkCore.Migrations[20402] Applying migration '20191212080541_mig01'. info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (34ms) [Parameters=[], CommandType='Text', CommandTimeo ut='30'] CREATE TABLE "AspNetRoles" ( "Id" text NOT NULL, "Name" character varying(256) NULL, "NormalizedName" character varying(256) NULL, "ConcurrencyStamp" text NULL, CONSTRAINT "PK_AspNetRoles" PRIMARY KEY ("Id") ); info: Microsoft.EntityFrameworkCore.Database.Command[20101] Executed DbCommand (23ms) [Parameters=[], CommandType='Text', CommandTimeo ut='30'] CREATE TABLE "AspNetUsers" ( "Id" text NOT NULL, "UserName" character varying(256) NULL, "NormalizedUserName" character varying(256) NULL, "Email" character varying(256) NULL, "NormalizedEmail" character varying(256) NULL, "EmailConfirmed" boolean NOT NULL, "PasswordHash" text NULL, "SecurityStamp" text NULL, "ConcurrencyStamp" text NULL, "PhoneNumber" text NULL, "PhoneNumberConfirmed" boolean NOT NULL, "TwoFactorEnabled" boolean NOT NULL, "LockoutEnd" timestamp with time zone NULL, "LockoutEnabled" boolean NOT NULL, "AccessFailedCount" integer NOT NULL, CONSTRAINT "PK_AspNetUsers" PRIMARY KEY ("Id") ); fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (220ms) [Parameters=[], CommandType='Text', Com mandTimeout='30'] CREATE TABLE "AspNetRoleClaims" ( "Id" integer NOT NULL GENERATED BY DEFAULT AS IDENTITY, "RoleId" text NOT NULL, "ClaimType" text NULL, "ClaimValue" text NULL, CONSTRAINT "PK_AspNetRoleClaims" PRIMARY KEY ("Id"), CONSTRAINT "FK_AspNetRoleClaims_AspNetRoles_RoleId" FOREIGN KEY ("Role Id") REFERENCES "AspNetRoles" ("Id") ON DELETE CASCADE ); fail: Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMid dleware[7] An error occurred while applying the migrations for 'WebApplication1.Data. ApplicationDbContext'. See InnerException for details: Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "GENERATED " at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken canc ellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(Re lationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery( IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor .ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connecti on) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(D atabaseFacade databaseFacade) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMid dleware.Invoke(HttpContext context) Exception data: Severity: ERROR SqlState: 42601 MessageText: syntax error at or near "GENERATED" Position: 62 File: scan.l Line: 1086 Routine: scanner_yyerror fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. System.InvalidOperationException: An error occurred while applying the migration s for 'WebApplication1.Data.ApplicationDbContext'. See InnerException for detail s.Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "GENERAT ED" at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken canc ellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(Re lationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery( IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor .ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connecti on) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(D atabaseFacade databaseFacade) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMid dleware.Invoke(HttpContext context) Exception data: Severity: ERROR SqlState: 42601 MessageText: syntax error at or near "GENERATED" Position: 62 File: scan.l Line: 1086 Routine: scanner_yyerror ---> Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "GEN ERATED" at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessa geLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken canc ellationToken) at Npgsql.NpgsqlCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(Re lationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery( IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor .ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connecti on) at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(D atabaseFacade databaseFacade) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMid dleware.Invoke(HttpContext context) Exception data: Severity: ERROR SqlState: 42601 MessageText: syntax error at or near "GENERATED" Position: 62 File: scan.l Line: 1086 Routine: scanner_yyerror --- End of inner exception stack trace --- at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMid dleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMidd leware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMidd leware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(H ttpContext context) info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished in 879.2697ms 500 text/plain Ну, я всё понимаю, но тут видно, что кусок скрипта - постгресовский (character varying и т.д.) и ошибка на куске, который постгрес (9.*) не понимает CREATE TABLE "AspNetRoleClaims" ( "Id" integer NOT NULL GENERATED BY DEFAULT AS IDENTITY, Что не так в этот раз, коллеги? ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2019, 11:20 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
syntax error at or near "GENERATED" тут явная проблема постгрес-адаптера для EF вырисовывается... свежесть версии адаптера проверял? Не бета? ошибку гуглил? issues у них в репозитории смотрел? Может версия постгрес-сервера? Я в постгресе не бум-бум ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2019, 11:46 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Shocker.Pro syntax error at or near "GENERATED" тут явная проблема постгрес-адаптера для EF вырисовывается... свежесть версии адаптера проверял? Не бета? ошибку гуглил? issues у них в репозитории смотрел? Может версия постгрес-сервера? Я в постгресе не бум-бум Да там скорее сервер, видимо, да, у меня 9.6, а эти идентити с версии 10. Но тоже странно, ограничение на версию не написано. Хорошо, я сейчас проделаю это на 11 версии, а как быть, если приложение должно работать с 9.6 в AWS? ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2019, 13:07 |
|
Как в cshtml сделать редирект?
|
|||
---|---|---|---|
#18+
Ролг Хупин skyANA Ролг Хупин, это ты так WinForms приложение на веб переводишь? Не то чтобы перевожу, но практичеки надо сделать ASP.NET клиента, и соответственно сервер, база остается А WinForms клиент не использует аутентификацию и авторизацию? И с базой он уже работает. Большая проблема взять код из него? К чему все эти танцы с бубном? ... |
|||
:
Нравится:
Не нравится:
|
|||
12.12.2019, 13:13 |
|
|
start [/forum/search_topic.php?author=Amix&author_mode=last_topics&do_search=1]: |
0ms |
get settings: |
7ms |
get forum list: |
14ms |
get settings: |
7ms |
get forum list: |
12ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
157ms |
get topic data: |
10ms |
get forum data: |
2ms |
get page messages: |
57ms |
get tp. blocked users: |
1ms |
others: | 263ms |
total: | 536ms |
0 / 0 |