This project is read-only.

The database file is larger than the configured maximum database size.

Topics: General, Troubleshooting
Jul 24, 2013 at 11:18 PM
1 of my customer site having this issue with SQLCE. without go into the source code from IT PRO view, any idea how to solve this ?

Exception Details: System.Data.SqlServerCe.SqlCeException: The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only. [ Required Max Database Size (in MB; 0 if unknown) = 257 ]
Jul 24, 2013 at 11:25 PM
I think the database size is normally specified in the connection string, find the connection string and change it to something like
Max Database Size=1024

that should increase it i think, of it doesn't exist add it, not sure if orchard adds it by default and i cant check at the moment.

Jul 25, 2013 at 4:48 PM
I can't locate where's the connectionstring for sql ce. Is not under the setting.txt. any idea where I can get using the source code version ?
Jul 25, 2013 at 5:50 PM
It should be in App_Data/Sites/Default/Settings.txt, assuming you are using the default tenant.
Jul 26, 2013 at 2:59 AM
I know, but im using sqlce, sqlce connstring is not in the settings.txt. the data connstring show on NULL in that fill.
Jul 26, 2013 at 9:53 AM
I'm sure i read somewhere that if there is no connection string present, then Orchard creates uses the default sqlce and creates the blank database, so in theory if you build a connection string that points to the existing sqlce database, and has the data provider I would have though it would work...

Maybe one of the Devs could confirm this?

SqlCE defaults to 256 mb i think, which would explain your problem.

A Quick google should get you the connection string parameters.

Jul 27, 2013 at 6:04 AM
Yes, that should work just fine, don't see why not.
Sep 9, 2013 at 5:29 PM
Hmm.... I have a setting like this in my settings.txt file but it seems like the max database size property is being ignored, since I get the same error message:

Name: Default
DataProvider: SqlCe
DataConnectionString: Data Source=|DataDirectory|\Sites\Default\Orchard.sdf;Max Database Size=1024;Persist Security Info=False;

I changed the database file name to something else and tried but then Orchard could not locate the sdf file. Do I need to tell Orchard somehow to look for a different file other than in the settings.txt file?
Jan 2, 2014 at 11:27 AM
I have the same error so added the connection string but It makes no difference! Somebody out there must know the answer?
Jan 2, 2014 at 11:51 AM
Looking at the SqlCeDataServicesProvider class, it seems that the connection string is generated dynamically, so its not using the connection string key specified in Settings.txt. You might want to file a bug about this, and for the time being, you might want to change this code yourself to include the Max Database Size value.
Jan 2, 2014 at 12:13 PM
Thanks sfmskywalker, I am front end developer so this is out depth. Do I need the project source to be able to change this? I only have the website files that I upload via FTP.
Jan 2, 2014 at 12:27 PM
Edited Jan 2, 2014 at 12:28 PM
Ok. Yeah, you will have to download the project source, look for the file "SqlCeDataServicesProvider.cs" in Orchard.Framework/Data/Providers and change line 39 from this:
string localConnectionString = string.Format("Data Source={0}", _fileName);
To this:
string localConnectionString = string.Format("Data Source={0};Max Database Size=1024", _fileName);
Then build the solution, and copy over Orchard.Framework.dll to your own project (replace all occurrences of that file with your custom built one).
Alternatively, you keep the source project and copy over your theme and database, and continue working from there.

Please note that I do not encourage changing the core files. The better solution would be to file a bug (and change the source for the time being :)).
Jan 2, 2014 at 9:28 PM
There is also the option to shrink the DB, it could be done from visual studio when you have installed the SQL CE Toolbox
Jan 2, 2014 at 10:02 PM
Great, is Media stored in the DB aswel? such as pictures etc.....

I have noticed that my client has over 90 blog posts that each contain at least 1 image over 1MB, and some are as big as 4MB. Crazy!
Jan 2, 2014 at 11:04 PM
Edited Jan 3, 2014 at 12:00 AM
When you frequently publish variants of your content as it could be the case with blogs, Orchard is not 'optimized' to have minimal DB growth and you keep all the old versions inside your DB.
As SQL CE is not as optimized as real SQL Server, all these unused pieces of data could grow the DB file abnormaly.

Concerning images from Blog I can't say if they are in database, using SQL CE they shouldn't, but as there are some external bloging tools allowing serialisation of the images as blob data, there could be images inside data (if the body column in corresponding Orchard table is declared with maxsize ....).
And in this option, each update/publish will duplicate the content....

All you could do is try to compact or shrink existing data using a better placement of data pages inside the sql engine.
May be there is also an Orchard module able to clean/repair the Orchard DB, I don't know about such a module personnaly but would be interested to use.

The last options are to increase your maxsize with the solution mentionned by Sipke or to migrate to SQL Server.
This last one should be the best choice.
Jan 2, 2014 at 11:54 PM
Edited Jan 2, 2014 at 11:55 PM
danmitchell wrote:
Great, is Media stored in the DB aswel? such as pictures etc.....
Media files themselves aren't stored in the DB by default; they are stored on disk (or in Blob storage if you deployed the Azure solution).
Jan 3, 2014 at 12:36 AM
Thanks for the reply guys, this all makes sense.

I am attempting to migrate to a SQL Express DB using Web Matrix.