Unable to login after update 1.5.2 -> 1.5.5
-
@theopenem_admin You mean the installer itself? No. My understanding from the instruction was this would happen after first login via GUI, yet I never managed to login.
-
No it's the web UI. It should ask you to upgrade before logging in. Maybe try restarting web service or rebooting server if it's not asking.
-
Restarted IIS. When I browse to the UI, I get a login page with message below "Could Not Determine Database Version" and the log shows:
2023-06-29 16:09:33,756 [7] ERROR Toems_ApiCalls.ApiRequest Response Data Was Null For Resource: Version/GetAllVersionInfo 2023-06-29 16:09:33,774 [7] ERROR Toems_ApiCalls.ApiRequest Response Data Was Null For Resource: Setting/CheckMfaEnabled/
Could it be related to that?
-
Probably, if doesn't know the current version it can't update. What if you manually go to http://localhost/dbupdate.aspx
-
Getting this:
-
You used the update installer and not the full installer correct?
-
Correct. Theopenem.Update-1.5.5.msi.
I believe however that I have seen the message "Could Not Determine Database Version" appear even on 1.5.2, but because everything was working, I haven't chased it. -
We would need to hop into heidisql to look at the version table.
-
-
Not sure why this is happening. You could try manually updating the database. In HeidiSQL select the theopenem database then select the query tab, paste in this script to go from 1.5.2 to 1.5.5. Then execute the script.
UPDATE `toems_version` SET `expected_app_version` = '1.5.3.0', `database_version` = '1.5.3.0', `expected_toecapi_version` = '1.5.3.0', `latest_client_version` = '1.5.0.0' WHERE (`toems_version_id` = '1'); CREATE TABLE `toems_usergroup_memberships` ( `usergroup_membership_id` INT NOT NULL AUTO_INCREMENT, `user_group_id` INT NOT NULL, `user_id` INT NOT NULL, PRIMARY KEY (`usergroup_membership_id`)) DEFAULT CHARACTER SET = utf8; ALTER TABLE `toems_usergroup_memberships` ADD INDEX `userfk_idx` (`user_id` ASC), ADD INDEX `usergroupfk_idx` (`user_group_id` ASC); ALTER TABLE `toems_usergroup_memberships` ADD CONSTRAINT `userfk` FOREIGN KEY (`user_id`) REFERENCES `toems_users` (`toems_user_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `usergroupfk` FOREIGN KEY (`user_group_id`) REFERENCES `toems_user_groups` (`toems_user_group_id`) ON DELETE CASCADE ON UPDATE NO ACTION; ALTER TABLE `toems_user_groups` ADD COLUMN `enable_image_acls` TINYINT NULL DEFAULT 0 AFTER `toems_user_group_ldapname`, ADD COLUMN `enable_computergroup_acls` TINYINT NULL DEFAULT 0 AFTER `enable_image_acls`; CREATE TABLE `toems_user_groups_image_acls` ( `toems_user_groups_image_acls_id` INT NOT NULL AUTO_INCREMENT, `user_group_id` INT NOT NULL, `image_id` INT NOT NULL, PRIMARY KEY (`toems_user_groups_image_acls_id`)) DEFAULT CHARACTER SET = utf8; ALTER TABLE `toems_user_groups_image_acls` ADD INDEX `FK_UG_IACLS_idx` (`image_id` ASC), ADD INDEX `FK_UG_CGACLS_idx` (`user_group_id` ASC); ALTER TABLE `toems_user_groups_image_acls` ADD CONSTRAINT `FK_UG_IACLS` FOREIGN KEY (`image_id`) REFERENCES `images` (`image_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `FK_UG_uGACLS` FOREIGN KEY (`user_group_id`) REFERENCES `toems_user_groups` (`toems_user_group_id`) ON DELETE CASCADE ON UPDATE NO ACTION; CREATE TABLE `toems_user_groups_computer_acls` ( `toems_user_groups_computer_acls_id` INT NOT NULL AUTO_INCREMENT, `user_group_id` INT NOT NULL, `group_id` INT NOT NULL, PRIMARY KEY (`toems_user_groups_computer_acls_id`)) DEFAULT CHARACTER SET = utf8; ALTER TABLE `toems_user_groups_computer_acls` ADD INDEX `FK_UG_CGACLS_idx` (`group_id` ASC), ADD INDEX `FK_UG1_UGACLS_idx` (`user_group_id` ASC); ALTER TABLE `toems_user_groups_computer_acls` ADD CONSTRAINT `FK_UG_CGACLS` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `FK_UG1_UGACLS` FOREIGN KEY (`user_group_id`) REFERENCES `toems_user_groups` (`toems_user_group_id`) ON DELETE CASCADE ON UPDATE NO ACTION; CREATE TABLE `toems_users_images` ( `toems_users_image_id` INT NOT NULL AUTO_INCREMENT, `user_id` INT NOT NULL, `image_id` INT NOT NULL, PRIMARY KEY (`toems_users_image_id`)) DEFAULT CHARACTER SET = utf8; ALTER TABLE `toems_users_images` ADD INDEX `fk_tui_user_idx` (`user_id` ASC), ADD INDEX `fk_tui_image_idx` (`image_id` ASC); ALTER TABLE `toems_users_images` ADD CONSTRAINT `fk_tui_user` FOREIGN KEY (`user_id`) REFERENCES `toems_users` (`toems_user_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `fk_tui_image` FOREIGN KEY (`image_id`) REFERENCES `images` (`image_id`) ON DELETE CASCADE ON UPDATE NO ACTION; CREATE TABLE `toems_users_groups` ( `toems_users_group_id` INT NOT NULL AUTO_INCREMENT, `group_id` INT NOT NULL, `user_id` INT NOT NULL, PRIMARY KEY (`toems_users_group_id`)) DEFAULT CHARACTER SET = utf8; ALTER TABLE `toems_users_groups` ADD INDEX `fk_tug_group_idx` (`group_id` ASC), ADD INDEX `fk_tug_user_idx` (`user_id` ASC); ALTER TABLE `toems_users_groups` ADD CONSTRAINT `fk_tug_group` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `fk_tug_user` FOREIGN KEY (`user_id`) REFERENCES `toems_users` (`toems_user_id`) ON DELETE CASCADE ON UPDATE NO ACTION; UPDATE `toems_version` SET `expected_app_version` = '1.5.4.0', `database_version` = '1.5.4.0', `expected_toecapi_version` = '1.5.4.0', `latest_client_version` = '1.5.4.0' WHERE (`toems_version_id` = '1'); ALTER TABLE `image_profiles` ADD COLUMN `set_bootmgr_first` TINYINT(4) NOT NULL DEFAULT 1 AFTER `skip_bitlocker_check`; ALTER TABLE `filecopy_modules` ADD COLUMN `is_driver` TINYINT(4) NOT NULL DEFAULT 0 AFTER `filecopy_overwrite`; INSERT INTO `admin_settings` (`admin_setting_name`, `admin_setting_value`) VALUES ('Default Image Replication', 'All'); ALTER TABLE `images` ADD COLUMN `replication_mode` TINYINT(4) NOT NULL DEFAULT 0 AFTER `image_type`; CREATE TABLE `image_replication_servers` ( `image_replication_server_id` INT NOT NULL AUTO_INCREMENT, `image_id` INT NOT NULL, `com_server_id` INT NOT NULL, PRIMARY KEY (`image_replication_server_id`)); ALTER TABLE `image_replication_servers` ADD INDEX `fk_irs_image_idx` (`image_id` ASC), ADD INDEX `fk_irs_comserver_idx` (`com_server_id` ASC); ALTER TABLE `image_replication_servers` ADD CONSTRAINT `fk_irs_image` FOREIGN KEY (`image_id`) REFERENCES `images` (`image_id`) ON DELETE CASCADE ON UPDATE NO ACTION, ADD CONSTRAINT `fk_irs_comserver` FOREIGN KEY (`com_server_id`) REFERENCES `client_com_servers` (`client_com_server_id`) ON DELETE CASCADE ON UPDATE NO ACTION; INSERT INTO `admin_settings` (`admin_setting_name`, `admin_setting_value`) VALUES ('Image Replication Time', 'Scheduler'); INSERT INTO `admin_settings` (`admin_setting_name`, `admin_setting_value`) VALUES ('Replication In Progress', 'False'); CREATE TABLE `default_image_replication_servers` ( `default_image_replication_server_id` INT NOT NULL AUTO_INCREMENT, `com_server_id` INT NOT NULL, PRIMARY KEY (`default_image_replication_server_id`)); ALTER TABLE `default_image_replication_servers` ADD INDEX `dimrs_com_idx` (`com_server_id` ASC); ALTER TABLE `default_image_replication_servers` ADD CONSTRAINT `dimrs_com` FOREIGN KEY (`com_server_id`) REFERENCES `client_com_servers` (`client_com_server_id`) ON DELETE CASCADE ON UPDATE NO ACTION; INSERT INTO `admin_settings` (`admin_setting_name`, `admin_setting_value`) VALUES ('Web UI Timeout', '60'); INSERT INTO `admin_settings` (`admin_setting_name`, `admin_setting_value`) VALUES ('Last Wie Guid', ''); CREATE TABLE `wie_builds` ( `wie_build_id` INT NOT NULL AUTO_INCREMENT, `wie_guid` VARCHAR(45) NULL, `datetime_started` DATETIME NULL, `datetime_end` DATETIME NULL, `status` VARCHAR(45) NULL, `build_options` MEDIUMTEXT NULL, PRIMARY KEY (`wie_build_id`)); ALTER TABLE `wie_builds` ADD COLUMN `pid` VARCHAR(45) NULL AFTER `build_options`; INSERT INTO `admin_settings` (`admin_setting_name`, `admin_setting_value`) VALUES ('Default WIE Image Type', 'File'); UPDATE `toems_version` SET `expected_app_version` = '1.5.5.0', `database_version` = '1.5.5.0', `expected_toecapi_version` = '1.5.5.0', `latest_client_version` = '1.5.4.0' WHERE (`toems_version_id` = '1');
-
Thank you, that ran without issues, however unfortunately the problem still persists:
2023-07-03 13:26:20,688 [14] ERROR Toems_ApiCalls.ApiRequest Response Data Was Null For Resource: Version/GetAllVersionInfo 2023-07-03 13:26:20,704 [14] ERROR Toems_ApiCalls.ApiRequest Response Data Was Null For Resource: Setting/CheckMfaEnabled/ 2023-07-03 13:26:20,766 [14] ERROR Toems_ApiCalls.TokenApi Error Obtaining Token: System.Xml.XmlException: '100' is an unexpected token. The expected token is '"' or '''. Line 28, position 65. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options) at RestSharp.Deserializers.XmlDeserializer.Deserialize[T](IRestResponse response) at RestSharp.RestClient.Deserialize[T](IRestRequest request, IRestResponse raw) 2023-07-03 13:26:20,766 [14] ERROR Toems_ApiCalls.TokenApi Error Obtaining Token: <!DOCTYPE html> <html> <head> <title>The model backing the 'ToemsDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).</title> <meta name="viewport" content="width=device-width" /> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:pointer; } @media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } @media screen and (max-width: 479px) { pre { width: 280px; } } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>The model backing the 'ToemsDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br><br> <b> Exception Details: </b>System.InvalidOperationException: The model backing the 'ToemsDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).<br><br> <b>Source Error:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code> An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. </code> </td> </tr> </table> <br> <b>Stack Trace:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> [InvalidOperationException: The model backing the 'ToemsDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).] System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +286 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +75 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +502 System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +171 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +272 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +20 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +69 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21 System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +66 System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +64 Toems_DataModel.GenericRepository`1.GetFirstOrDefault(Expression`1 filter, Func`2 orderBy) +177 Toems_Service.Entity.ServiceSetting.GetSetting(String settingName) +562 Toems_Service.Entity.ServiceSetting.GetSettingValue(String settingName) +91 Toems_ApplicationApi.Startup.Configuration(IAppBuilder app) +289 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +216 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +182 Owin.Loader.<>c__DisplayClass19_1.<MakeDelegate>b__0(IAppBuilder builder) in /_/src/Owin.Loader/DefaultLoader.cs:429 Owin.Loader.<>c__DisplayClass9_0.<LoadImplementation>b__0(IAppBuilder builder) in /_/src/Owin.Loader/DefaultLoader.cs:128 Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) in /_/src/Microsoft.Owin.Host.SystemWeb/OwinAppContext.cs:82 Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) in /_/src/Microsoft.Owin.Host.SystemWeb/OwinBuilder.cs:64 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() in /_/src/Microsoft.Owin.Host.SystemWeb/OwinHttpModule.cs:46 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +139 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) in /_/src/Microsoft.Owin.Host.SystemWeb/OwinHttpModule.cs:24 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +587 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +255 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +347 [HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +552 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +732 </pre> </code> </td> </tr> </table> <br> <hr width=100% size=1 color=silver> <b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9037.0 </font> </body> </html> <!-- [InvalidOperationException]: The model backing the 'ToemsDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269). at System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() at System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() at System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate) at Toems_DataModel.GenericRepository`1.GetFirstOrDefault(Expression`1 filter, Func`2 orderBy) at Toems_Service.Entity.ServiceSetting.GetSetting(String settingName) at Toems_Service.Entity.ServiceSetting.GetSettingValue(String settingName) at Toems_ApplicationApi.Startup.Configuration(IAppBuilder app) [TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Owin.Loader.DefaultLoader.<>c__DisplayClass19_1.<MakeDelegate>b__0(IAppBuilder builder) in /_/src/Owin.Loader/DefaultLoader.cs:line 429 at Owin.Loader.DefaultLoader.<>c__DisplayClass9_0.<LoadImplementation>b__0(IAppBuilder builder) in /_/src/Owin.Loader/DefaultLoader.cs:line 128 at Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) in /_/src/Microsoft.Owin.Host.SystemWeb/OwinAppContext.cs:line 82 at Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) in /_/src/Microsoft.Owin.Host.SystemWeb/OwinBuilder.cs:line 64 at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() in /_/src/Microsoft.Owin.Host.SystemWeb/OwinHttpModule.cs:line 46 at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) in /_/src/Microsoft.Owin.Host.SystemWeb/OwinHttpModule.cs:line 24 at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) [HttpException]: Exception has been thrown by the target of an invocation. at System.Web.HttpRuntime.FirstRequestInit(HttpContext context) at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) -->
-
@theopenem_admin - Don't chase this further - I believe this is a remnant from my failed attempt at upgrading MariaDB - https://forum.theopenem.com/topic/466/unable-to-to-login-system-invalidcastexception-object-cannot-be-cast-from-dbnull-to-other-types .
Back then I had to downgrade and because of all the database enconding and collation changes I had to manually edit my MariaDB 10.11 backup so I can have it restored under 10.5. I belive this is now causing my database schema, although working to be out of sync with the model/schema in your coude - hense 'The model backing the context has changed since the database was created.'. What I did was go back to a pre-MariaDB upgrade backup, had that restored, it properly updated to 1.5.5. and now I can login fine. Thanks for your help anyway!