IIS Error - Couldn't determine a writable folder where to store realm file. Specify absolute path manually

Hi,

I’m using MongoDb realm with .NET SDK. Have build and deployed a webAPI to a VPS with IIIS on it.
When accessing the API, I get the following error:

Couldn’t determine a writable folder where to store realm file. Specify absolute path manually

.NET SDK has this path configurable, so I set it up in as follows:

var config = new PartitionSyncConfiguration(publicPartitionId, user, optionalPath: localRealmFilePath);

The localRealmFilePath is set to “C:\inetpub\wwwroot\MongoRealmDatabase\Default”.

I’ve even tried giving write access to IIS_IUSRS user on the MongoRealmDatabase folder.

Any advice is greatly appreciated.

Hi @alps, thanks for your message.
When using Sync there are actually two paths you can specify. One of those is the one you already set, that is the one where the local realm is saved.
There is also AppConfiguration.BaseFilePath that is used for storing all local data for your application, including metadata for users and synchronized Realms. The error you are getting is because probably the default folder for this parameter cannot be used. This can be set when when creating the App. For instance:

var config = new AppConfiguration("appId")
{
   BaseFilePath= --- your path ----
};

var app = App.Create(config);

Setting also this to an accessible folder should solve your issue.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.