# System.InvalidCastException when trying to access portal

**URL:** https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569
**Category:** Workspace
**Tags:** linux, bug
**Created:** [14 January 2023 06:13 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569 "2023-01-14T06:13:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![ps\_iclimbthings](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/p/a88e4f/32.png) [@ps\_iclimbthings](https://community.onlyoffice.com/u/ps_iclimbthings)
#### Post date: [14 January 2023 06:13 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/1 "2023-01-14T06:13:44Z")

</div>

I installed the latest version of onlyoffice-communityserver on Debian 11, with two modifications from standard: Using an externally hosted MariaDB 10.9, and changing the port to 9970 instead of 80 in /etc/nginx/sites-available/onlyoffice (port 80 is already taken on this host). I used the instructions provided at [Installing ONLYOFFICE Groups for Debian, Ubuntu, and derivatives - ONLYOFFICE](https://helpcenter.onlyoffice.com/installation/groups-install-ubuntu.aspx)

It looks like onlyoffice can connect to the DB, as it created and populated the tables in the database I gave to it. However, when I try to connect to the portal, I get the following error:

```auto
System.InvalidCastException
Object cannot be cast from DBNull to other types.

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
  at System.DBNull.System.IConvertible.ToInt32 (System.IFormatProvider provider) [0x00000] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at System.Convert.ToInt32 (System.Object value, System.IFormatProvider provider) [0x00003] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at MySql.Data.MySqlClient.Driver.LoadCharacterSets (MySql.Data.MySqlClient.MySqlConnection connection) [0x000bc] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.Configure (MySql.Data.MySqlClient.MySqlConnection connection) [0x00060] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0024f] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at ASC.Common.Data.AdoProxy.DbConnectionProxy.Open () [0x00012] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.OpenConnection () [0x00006] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.get_Command () [0x0000e] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.ExecuteList (ASC.Common.Data.Sql.ISqlInstruction sql) [0x00000] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManagerProxy.ExecuteList (ASC.Common.Data.Sql.ISqlInstruction sql) [0x00006] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Core.Data.DbBaseService+<>c __DisplayClass8_0.<ExecList>b__ 0 (ASC.Common.Data.IDbManager db) [0x00000] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Data.DbBaseService.Execute[T] (System.Func`2[T,TResult] action) [0x00007] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Data.DbBaseService.ExecList (ASC.Common.Data.Sql.ISqlInstruction sql) [0x0000d] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Data.DbTenantService.GetTenants (ASC.Common.Data.Sql.Expressions.Exp where) [0x00007] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Data.DbTenantService.GetTenant (System.String domain) [0x00039] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Caching.CachedTenantService.GetTenant (System.String domain) [0x00012] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.TenantManager.GetTenant (System.String domain) [0x0001f] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.TenantManager.GetCurrentTenant (System.Boolean throwIfNotFound) [0x00047] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Common.Logging.LogManager+<>c.<GetLogger>b__0_0 () [0x00005] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Common.Logging.LogNLog.Log (NLog.LogEventInfo theEvent) [0x00008] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Logging.LogNLog.Log (NLog.LogLevel level, System.Object message) [0x00025] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Logging.LogNLog.Error (System.Object message) [0x00000] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Api.ApiSetupHttpModule.Init (System.Web.HttpApplication context) [0x00053] in <1174082600f44859b26bb99bb8c52778>:0 
  at System.Web.Configuration.HttpModulesSection.LoadModules (System.Web.HttpApplication app) [0x00047] in <ed5a28140a7245099ac6474902196c2e>:0 
  at System.Web.HttpApplication.InitOnce (System.Boolean full_init) [0x0008e] in <ed5a28140a7245099ac6474902196c2e>:0

```

I had to turn off `customErrors` in `/var/www/onlyoffice/WebStudio/Web.config` to see this error message. I did try uninstalling and re-installing the onlyoffice-communityserver package, but it didn’t change. There is nothing in any error logs I can find, but I’d be happy to share any error logs you request. I’m a software developer with experience in Node, [ASP.NET](http://ASP.NET), linux, etc, so feel free to use technical jargon. I’m just hoping to get this working. I had it working on Ubuntu 22 in a test VM, but I haven’t got it to work since I switched to Debian 11 with MariaDB for prod.

---

<div class="post-metadata">

### Author: ![ps\_iclimbthings](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/p/a88e4f/32.png) [@ps\_iclimbthings](https://community.onlyoffice.com/u/ps_iclimbthings)
#### Post date: [14 January 2023 15:56 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/2 "2023-01-14T15:56:14Z")

</div>

Update: I switched to using an internal MySQL 8 server, and that allowed me to access the portal. I’m curious why that is, the instructions say that MariaDB worked. Perhaps it is the external database that is an issue? Or maybe it doesn’t work without root access? Would love to see that fixed.

Control panel isn’t working now, returns an app error:

```auto
2023-01-14 10:51:51 - error: http://localhost/api/2.0/settings/controlpanel.json write EPROTO 140485465192320:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 80

```

I assume this is because it should be requesting localhost:9970 instead of just localhost

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [17 January 2023 11:25 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/3 "2023-01-17T11:25:10Z")

</div>

Hello @ps_iclimbthings

Sorry for the late reply.

Please share more information on the issue:

- version of MariaDB;
- OS of the server where database is installed;

> [@ps\_iclimbthings](#):
>
> Perhaps it is the external database that is an issue?

Possibly it is configured incorrectly. Please refer to this link to see the example of database configuration:  
[https://github.com/ONLYOFFICE/Docker-CommunityServer#installing-mysql](https://github.com/ONLYOFFICE/Docker-CommunityServer#installing-mysql)

> [@ps\_iclimbthings](#):
>
> Or maybe it doesn’t work without root access?

This is a good point. If possible try granting root access to the database and checking the situation after.

> [@ps\_iclimbthings](#):
>
> I assume this is because it should be requesting localhost:9970 instead of just localhost

Please check next config _www/config/ **production.json** _ and the port used. If port differs from currently used one then change it and restart portal with command `service monoserve restart` and Control Panel with `supervisorctl restart www` . After portal is booted up try reaching the Control Panel again.

---

<div class="post-metadata">

### Author: ![ps\_iclimbthings](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/p/a88e4f/32.png) [@ps\_iclimbthings](https://community.onlyoffice.com/u/ps_iclimbthings)
#### Post date: [18 January 2023 03:42 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/4 "2023-01-18T03:42:46Z")

</div>

@Constantine Thanks for the help. I’ve pivoted a bit, now using docker to run (onlyoffice/communityserver latest), which worked with mysql 8, but is failing with MariaDB 10.10 (latest running in docker: [Docker](https://hub.docker.com/_/mariadb))

Here are the relevant parts of my docker run command (I excluded some arguments for brevity):

```auto
docker run -i -t -d --privileged --restart=always \
    --name onlyoffice-community-server \
    --cgroupns=host \
    -e MYSQL_SERVER_ROOT_PASSWORD=######### \
    -e MYSQL_SERVER_DB_NAME=onlyoffice_groups \
    -e MYSQL_SERVER_HOST=db \
    -e MYSQL_SERVER_USER=onlyoffice_groups \
    -e MYSQL_SERVER_PASS=######## \
    -v /sys/fs/cgroup:/sys/fs/cgroup:rw \
    onlyoffice/communityserver

```

I did put it on the same network as my MariaDB instance, and it does appear from the logs that it can connect and that the credentials are correct.

The error I am now getting is:

```auto
ERROR [10] ASC.Backup.Scheduler - error while scheduling backups: {0} System.InvalidCastException: Object cannot be cast from DBNull to other types.
  at System.DBNull.System.IConvertible.ToInt32 (System.IFormatProvider provider) [0x00000] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at System.Convert.ToInt32 (System.Object value, System.IFormatProvider provider) [0x00003] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at MySql.Data.MySqlClient.Driver.LoadCharacterSets (MySql.Data.MySqlClient.MySqlConnection connection) [0x000bc] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.Configure (MySql.Data.MySqlClient.MySqlConnection connection) [0x00060] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0024f] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at ASC.Common.Data.DbManager.OpenConnection () [0x00006] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.get_Command () [0x0000e] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.ExecuteList (ASC.Common.Data.Sql.ISqlInstruction sql) [0x00000] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Data.Backup.Storage.BackupRepository.GetBackupSchedules () [0x00086] in <5c0ed394f8794246b5703a880bd6a0d2>:0 
  at ASC.Data.Backup.Service.BackupSchedulerService.ScheduleBackupTasks () [0x0002b] in <5c0ed394f8794246b5703a880bd6a0d2>:0 
ERROR [7] ASC.Backup.Cleaner - error while cleaning expired backup records System.InvalidCastException: Object cannot be cast from DBNull to other types.
  at System.DBNull.System.IConvertible.ToInt32 (System.IFormatProvider provider) [0x00000] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at System.Convert.ToInt32 (System.Object value, System.IFormatProvider provider) [0x00003] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at MySql.Data.MySqlClient.Driver.LoadCharacterSets (MySql.Data.MySqlClient.MySqlConnection connection) [0x000bc] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.Configure (MySql.Data.MySqlClient.MySqlConnection connection) [0x00060] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0024f] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at ASC.Common.Data.DbManager.OpenConnection () [0x00006] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.get_Command () [0x0000e] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.ExecuteList (ASC.Common.Data.Sql.ISqlInstruction sql) [0x00000] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Data.Backup.Storage.BackupRepository.GetExpiredBackupRecords () [0x000a6] in <5c0ed394f8794246b5703a880bd6a0d2>:0 
  at ASC.Data.Backup.Service.BackupCleanerService.DeleteExpiredBackups () [0x00026] in <5c0ed394f8794246b5703a880bd6a0d2>:0 
ERROR [11] ASC.Feed.Agregator - System.InvalidCastException: Object cannot be cast from DBNull to other types.
  at System.DBNull.System.IConvertible.ToInt32 (System.IFormatProvider provider) [0x00000] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at System.Convert.ToInt32 (System.Object value, System.IFormatProvider provider) [0x00003] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at MySql.Data.MySqlClient.Driver.LoadCharacterSets (MySql.Data.MySqlClient.MySqlConnection connection) [0x000bc] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.Configure (MySql.Data.MySqlClient.MySqlConnection connection) [0x00060] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x0024f] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at ASC.Common.Data.DbManager.OpenConnection () [0x00006] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.get_Command () [0x0000e] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.ExecuteScalar[T] (ASC.Common.Data.Sql.ISqlInstruction sql) [0x00000] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Feed.Data.FeedAggregateDataProvider.GetLastTimeAggregate (System.String key) [0x00034] in <0ab92d6b4e274500855ca06732fa6e62>:0 
  at ASC.Feed.Aggregator.FeedAggregatorService.AggregateFeeds (System.Object interval) [0x0006a] in <c1a2e5bad0114912b4c92d41b081f85c>:0  
ERROR [11] ASC.Feed.Agregator - System.Collections.Generic.KeyNotFoundException: The given key '28271' was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at MySql.Data.MySqlClient.MySqlField.SetFieldEncoding () [0x00034] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlField.set_CharacterSetIndex (System.Int32 value) [0x00007] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.NativeDriver.GetColumnData (MySql.Data.MySqlClient.MySqlField field) [0x000ad] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.NativeDriver.GetColumnsData (MySql.Data.MySqlClient.MySqlField[] columns) [0x00004] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.GetColumns (System.Int32 count) [0x0001c] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.ResultSet.LoadColumns (System.Int32 numCols) [0x00000] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.ResultSet..ctor (MySql.Data.MySqlClient.Driver d, System.Int32 statementId, System.Int32 numCols) [0x0002a] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.NextResult (System.Int32 statementId, System.Boolean force) [0x00039] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x000d5] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlDataReader.Close () [0x00039] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ResetReader () [0x00020] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x0032c] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader () [0x00000] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar () [0x0002e] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at ASC.Common.Data.DataExtensions.ExecuteScalar[T] (System.Data.Common.DbCommand command, System.String sql, System.Object[] parameters) [0x00009] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DataExtensions.ExecuteScalar[T] (System.Data.Common.DbCommand command) [0x00007] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DataExtensions.ExecuteScalar[T] (System.Data.Common.DbCommand command, ASC.Common.Data.Sql.ISqlInstruction sql, ASC.Common.Data.Sql.ISqlDialect dialect) [0x00008] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.ExecuteScalar[T] (ASC.Common.Data.Sql.ISqlInstruction sql) [0x0000d] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Feed.Data.FeedAggregateDataProvider.GetLastTimeAggregate (System.String key) [0x00034] in <0ab92d6b4e274500855ca06732fa6e62>:0 
  at ASC.Feed.Aggregator.FeedAggregatorService.AggregateFeeds (System.Object interval) [0x0006a] in <c1a2e5bad0114912b4c92d41b081f85c>:0  
ERROR [26] ASC.Indexer - Ping false System.Collections.Generic.KeyNotFoundException: The given key '28271' was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <f2b3ab7dfff746f594d2ef5b16ec3c90>:0 
  at MySql.Data.MySqlClient.MySqlField.SetFieldEncoding () [0x00034] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlField.set_CharacterSetIndex (System.Int32 value) [0x00007] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.NativeDriver.GetColumnData (MySql.Data.MySqlClient.MySqlField field) [0x000ad] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.NativeDriver.GetColumnsData (MySql.Data.MySqlClient.MySqlField[] columns) [0x00004] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.GetColumns (System.Int32 count) [0x0001c] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.ResultSet.LoadColumns (System.Int32 numCols) [0x00000] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.ResultSet..ctor (MySql.Data.MySqlClient.Driver d, System.Int32 statementId, System.Int32 numCols) [0x0002a] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.Driver.NextResult (System.Int32 statementId, System.Boolean force) [0x00039] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x000d5] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlDataReader.Close () [0x00039] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ResetReader () [0x00020] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x0032c] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader () [0x00000] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar () [0x0002e] in <67abbb3783c24cd0a9c685bbfbcea559>:0 
  at ASC.Common.Data.DataExtensions.ExecuteScalar[T] (System.Data.Common.DbCommand command, System.String sql, System.Object[] parameters) [0x00009] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DataExtensions.ExecuteScalar[T] (System.Data.Common.DbCommand command) [0x00007] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DataExtensions.ExecuteScalar[T] (System.Data.Common.DbCommand command, ASC.Common.Data.Sql.ISqlInstruction sql, ASC.Common.Data.Sql.ISqlDialect dialect) [0x00008] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Common.Data.DbManager.ExecuteScalar[T] (ASC.Common.Data.Sql.ISqlInstruction sql) [0x0000d] in <71cb3d721bb9413ea8360000a194c805>:0 
  at ASC.Core.Data.DbBaseService+<>c__DisplayClass6_0`1[T].<ExecScalar>b__0 (ASC.Common.Data.IDbManager db) [0x00000] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Data.DbBaseService.Execute[T] (System.Func`2[T,TResult] action) [0x00007] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Data.DbBaseService.ExecScalar[T] (ASC.Common.Data.Sql.ISqlInstruction sql) [0x0000d] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Data.DbTenantService.GetTenantSettings (System.Int32 tenant, System.String key) [0x00030] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.Caching.CachedTenantService.GetTenantSettings (System.Int32 tenant, System.String key) [0x00022] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.CoreConfiguration.GetSetting (System.String key, System.Int32 tenant) [0x00013] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.CoreConfiguration.GetSection[T] (System.Int32 tenantId, System.String sectionName) [0x00000] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.Core.CoreConfiguration.GetSection[T] (System.Int32 tenantId) [0x00011] in <289eba5fc2ef4c3a9bc560fddf6ec9c8>:0 
  at ASC.ElasticSearch.Client.get_Instance () [0x0003d] in <3bb54ce544d94abf8906cb78d059ea79>:0 
  at ASC.ElasticSearch.FactoryIndexer.CheckState (System.Boolean cacheState) [0x00042] in <3bb54ce544d94abf8906cb78d059ea79>:0 

```

If I had to guess, it looks like some MariaDB incompatibility, because the error is during the load of a character set, but I don’t know much about character sets.

Thanks for any help!

---

<div class="post-metadata">

### Author: ![ps\_iclimbthings](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/p/a88e4f/32.png) [@ps\_iclimbthings](https://community.onlyoffice.com/u/ps_iclimbthings)
#### Post date: [18 January 2023 03:48 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/5 "2023-01-18T03:48:36Z")

</div>

Seems related to [c# - MySqlConnection.Open() System.InvalidCastException: Object cannot be cast from DBNull to other types - Stack Overflow](https://stackoverflow.com/questions/74060289/mysqlconnection-open-system-invalidcastexception-object-cannot-be-cast-from-d), going to try MariaDB 10.9.4 to see if that fixes

---

<div class="post-metadata">

### Author: ![ps\_iclimbthings](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/p/a88e4f/32.png) [@ps\_iclimbthings](https://community.onlyoffice.com/u/ps_iclimbthings)
#### Post date: [18 January 2023 04:06 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/6 "2023-01-18T04:06:16Z")

</div>

Looks like downgrading to MariaDB 10.9.4 does work. Seems like you guys should add support for 10.10 using the recommendations in that Stack Overflow article, or add a note on the system requirements page that 10.10+ is not supported.

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [18 January 2023 12:33 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/7 "2023-01-18T12:33:42Z")

</div>

We are checking the situation with MariaDB 10.10. I will update this thread when there are any news come up.

> [@ps\_iclimbthings](#):
>
> Looks like downgrading to MariaDB 10.9.4 does work

Does it mean that you’ve configured this version and it is working with your portal right now? Sorry if I misunderstood.

---

<div class="post-metadata">

### Author: ![ps\_iclimbthings](https://community.onlyoffice.com/letter_avatar_proxy/v4/letter/p/a88e4f/32.png) [@ps\_iclimbthings](https://community.onlyoffice.com/u/ps_iclimbthings)
#### Post date: [18 January 2023 13:11 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/8 "2023-01-18T13:11:58Z")

</div>

Yes, everything is working as expected now as far as this thread is concerned.

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [18 January 2023 13:13 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/9 "2023-01-18T13:13:30Z")

</div>

I’m glad to hear that.  
As I said we are checking the situation. I will let you know the results.

---

<div class="post-metadata">

### Author: ![Constantine](https://community.onlyoffice.com/user_avatar/community.onlyoffice.com/constantine/32/1469_2.png) [@Constantine](https://community.onlyoffice.com/u/Constantine)
#### Post date: [23 January 2023 07:11 UTC](https://community.onlyoffice.com/t/system-invalidcastexception-when-trying-to-access-portal/3569/10 "2023-01-23T07:11:34Z")

</div>

Hello again @ps_iclimbthings

Indeed, there is a bug with external MariaDB 10.10.x that prevents portal from starting up.  
We added it into our internal tracked under the number 60728. We are already looking for the way to solve it.  
Thanks for reporting and sorry for the inconvenience caused.
