Unable to access sqlce database

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
9/9/2013 5:15:58 AM
Gravatar
Total Posts 36

Unable to access sqlce database

Hi,

I have recreated my website using MS SQL CE. After uploading the file to my host site, I get the following error:


2013-09-09 09:48:49,893 ERROR (null) - (null) - (null) - mojoPortal.Web.WebTaskManager - System.Data.SqlServerCe.SqlCeException (0x80004005): Access to the database file is not allowed. [ 1884,File name = H:\hshome\admin4ulgham\ulgham.org.uk\App_Data\ulghamdb-sqlce.sdf,SeCreateFile ] at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) at System.Data.SqlServerCe.SqlCeConnection.Open() at mojoPortal.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters) at mojoPortal.Data.DBTaskQueue.DeleteCompleted() at mojoPortal.Web.WebTaskManager.StartOrResumeTasks(Boolean appWasRestarted) 2013-09-09 09:49:16,756 ERROR (null) - (null) - (null) - mojoPortal.Web.BannedIPBlockingHttpModule - handled exception: System.Data.SqlServerCe.SqlCeException (0x80004005): Access to the database file is not allowed. [ 1884,File name = H:\hshome\admin4ulgham\ulgham.org.uk\App_Data\ulghamdb-sqlce.sdf,SeCreateFile ] at System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) at System.Data.SqlServerCe.SqlCeConnection.Open() at mojoPortal.Data.SqlHelper.ExecuteScalar(String connectionString, CommandType commandType, String commandText, SqlCeParameter[] commandParameters) at mojoPortal.Data.DBBannedIP.IsBanned(String ipAddress) at mojoPortal.Web.BannedIPBlockingHttpModule.BeginRequest(Object sender, EventArgs e)
 

I have allowed full access to the App_Data folder and I think the permissions on the file are OK. Can you give me any pointers as to where the problem lies?

Thank you.

9/9/2013 9:38:28 AM
Gravatar
Total Posts 18439

Re: Unable to access sqlce database

If folder permissions did not correct the problem you may need to reset permissions on the specific file. File permissions can get funky when moving from one machine to another.

9/10/2013 8:08:47 AM
Gravatar
Total Posts 36

Re: Unable to access sqlce database

Thanks Joe! I hadn't set the security on the file correctly. I can now access the database file, but I cannot sign in with the administrator password. Nothing is being logged and no message is appearing on the page. Can you give me an indicator as to what may be happening?

Regards

Barbara

9/10/2013 10:26:47 AM
Gravatar
Total Posts 18439

Re: Unable to access sqlce database

If you were able to login when you had it running on your local machine it should use the same credentials.

Did you change the admin user email and password when you created the site on your local machine?

9/10/2013 11:33:09 AM
Gravatar
Total Posts 36

Re: Unable to access sqlce database

No, I didn't. I uploaded the database with the new security settings, which gave me access to the database. But it would not sign me in. I have iis-iusrs set to no-write, but allowed read/write/modify for network service on the database. Is that correct?

9/10/2013 11:44:28 AM
Gravatar
Total Posts 36

Re: Unable to access sqlce database

I've just reread your reply. If you meant the admin@admin.com default user, I have locked it out and using my own admin user account.

9/10/2013 11:45:30 AM
Gravatar
Total Posts 18439

Re: Unable to access sqlce database

Don't confuse mojoPortal users with Windows users. The Windows User that is the  Identity for the IIS application pool is who needs file system permission.

The mojoPortal user that can login to the site exists in the database. When you first install the default admin user is created with the email address admin@admin.com and the password admin you would use that to login to your site the first time.

Normally you should update the mojoportal user immediately after setting up your site to give it your own email address and a stronger password. If you don't change the mojoportal user before you upload the site to public hosting then anyone who knows your site is running mojoportal could login as admin using the default credentials.

If you did not change the mojoportal user credentials before uploading the site and database then you should be able to login using the default credentials unless someone else beat you to it and changed them.

9/12/2013 11:50:20 AM
Gravatar
Total Posts 36

Re: Unable to access sqlce database

I have made changes to the SQLCE database and now I can no longer access the pages again. The database is again not accessible and I get the same message as before. I have tried to upload it several times. I get the home page displayed, but cannot navigate the menu at all. Can you help at all? I don't know what else to do.

Regards

Barbara

9/12/2013 12:16:47 PM
Gravatar
Total Posts 18439

Re: Unable to access sqlce database

every time you upload the database file the file system permission on the file may get messed up and need to be fixed again, it is not something to do on a daily basis as part of workflow. 

9/12/2013 12:51:23 PM
Gravatar
Total Posts 36

Re: Unable to access sqlce database

If uploading the database file does not fix the problem, what else can be done?

Regards

 

9/12/2013 1:04:41 PM
Gravatar
Total Posts 18439

Re: Unable to access sqlce database

If the error is:

"Access to the database file is not allowed."

 It is a file system permission problem and it cannot read or write to the database file then you must fix the file system permissions so it can. The user that is the identity on the web application pool must have full control on this file.

If you are talking about some other problem then start a new thread and ask it clearly separate from this one. The answer to this problem has been given and is not going to be different in the future.

The problem is that uploading the db is the cause of the file system permission problem, the file is created and owned by a windows user with a SID system id  on your local machine but that user does not exist on the remote server but the remote server still sees the attributes on the file each time you upload it and it is owned by a user from your local windows that is unknown to the server so every time you upload it the  permissions are messed up again.

You should upload it fix the permissions so it works then don't repeat the process, treat it the same as backup and restore of a sql database, restoring a sql database is not something to keep doing every day and it is the same store for sql ce even though it is easier to do than with sql server it is not something to keep doing over and over, unless you want to keep breaking and fixing the file system permissions.

 

You must sign in to post in the forums. This thread is closed to new posts.