Update server database or asset database

This guide describe how to migrate the Assert4#Server database to a higher version.

Starting from version 5.1.5 it is only possible to access the WebAdmin pages from localhost. It is possible to make temporary, time limited, exception.

Problem description

Web viewer does not start or gives an error when signing in users.

Web viewer log file shows an error similar to the below.

AssertWeb Error: 0 : System.InvalidOperationException: The model backing the 'ServerContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

Root cause

Application has been updated and the new version of the application requires a new database for users etc. Database need to be migrated.

Step-by-step guide

Follow these steps to migrate server database.

  1. Create a backup copy of the server database using SQL Management Studio's tools for this.

  2. Sign in to the ServerAdmin page of the web viewer: http://localhost/AssertWeb/en/<site>/WebAdmin

  3. Choose Database migration. Note that Server and Asset databases have separate icons.

  4. The page will list the needed migrations.

  5. Click on "Update server database"

  6. For version 5.1, if Assets are configured, click on “Asset database” icon. Select “Update database“.

  7. Verify successful migration by signing in to Web Viewer as admin and look at each settings tab to see that information loads correctly.

If needed to access WebAdmin from outside localhost, use profile.config to temporarily turn on access externally.

Note! Ensure to make a backup of Server database before running any migration scripts.

It is recommended that you test migration of client ServerDB in a staging environment prior to updating production environment.

Configuration to temporarily allow external access

If it is not possible to access WebAdmin on localhost it is possible to temporarily turn on external access using profile.config. The below tag enables external access during the defined date, but during that date only.

<WebAdminActiveDate>2021-12-01</WebAdminActiveDate> <!-- Before v5.3 use this --> <WebAdminActvieDate>2021-12-01</WebAdminActvieDate>