SQLCE file sharing error

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.
1/29/2012 11:39:21 AM
Gravatar
Total Posts 36

SQLCE file sharing error

Could you please tell me why I am getting the following error

'2012-01-28 18:00:21,017 ERROR (null) - (null) - (null) - mojoPortal.Web.WebTaskManager - System.Data.SqlServerCe.SqlCeException (0x80004005): There is a file sharing violation. A different process might be using the file. [ \\web-123win\winpackage21\ulgham.org.uk\www.ulgham.org.uk\web\content\App_Data\ulghamdb.sdf ]
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)
2012-01-28 18:00:21,469 ERROR (null) - (null) - (null) - mojoPortal.Web.BannedIPBlockingHttpModule - handled exception:
System.Data.SqlServerCe.SqlCeException (0x80004005): There is a file sharing violation. A different process might be using the file. [ \\web-123win\winpackage21\ulgham.org.uk\www.ulgham.org.uk\web\content\App_Data\ulghamdb.sdf ]
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)'

The website is on a windows ASP.NET 4 shared hosting platform and I only have FTP access to the website. I'm using wasitup to keep the application alive, as well as your own appkeepalive feature. I'm getting a lot of these errors since I started using wasitup.

Hope you can help.

Regards

Barbara

1/29/2012 12:22:02 PM
Gravatar
Total Posts 18439

Re: SQLCE file sharing error

Hi,

SQL Ce only supports one process accessing the database at a time, if more than one process or program try to access a sql ce database at the same time it results in that kind of error. If more than one IIS web site or IIS application is trying to use the same database it will cause this kind of error, or if some other program is trying to access it while IIS is using it, will also cause this kind of error.

I don't think it is caused by using a service like was it up since that just makes web requests to your site those requests should all be in the same process unless you have multiple IIS sites pointing to the same files, then each site may have its own process and that would cause this kind of error.

My advice is if you're using was it up then don't use the appkeepalive, just use was it up. The app keepalive runs on a background thread but its in the same process so that shouldn't be a problem, but I'd avoid using it if you have was it up.

If you haven't banned any ip addresses then you could comment out BannedIPBlockingHttpModule in the 2 places where it exists in web.config and that will eliminate an un-needed hit to the database for each request.

Hope that helps,

Joe

1/29/2012 12:50:12 PM
Gravatar
Total Posts 36

Re: SQLCE file sharing error

Thanks for the quick response.

I was finding this error before I started using wasitup. I have issues with the performance of the website, so I have not yet informed many people of its existence. I don't know of any other processes which would be using the database. I've made the changes you have suggested and I will see how it goes.

Regards

Barbara

1/29/2012 1:12:57 PM
Gravatar
Total Posts 36

Re: SQLCE file sharing error

I am still getting the same errors, after making the changes you suggested.

I cannot think what could be causing this, unless my understanding of the SQLCE database is at fault.

I am not a web expert, but I have programmed in commercial environments for many years.

As far as I know, the database should not be accessed by any other processes. I don't have the means to check this out.

Is there anything more I can do?

Regards

Barbara

1/29/2012 1:45:23 PM
Gravatar
Total Posts 18439

Re: SQLCE file sharing error

Hi Barbara,

A different process might be using the file. [ \\web-123win\winpackage21\ulgham.org.uk\www.ulgham.org.uk\web\content\App_Data\ulghamdb.sdf ]

That file system path looks like it maps to a network share. I'm guessing you are hosted in some kind of web farm with multiple web servers accessing those same files, because different requests are being handled by different web servers more than one process is trying to use the file. You can't use SQL CE in a web farm scenario. 

My advice would be to use SQL Server instead of SQL Ce if you are getting errors like this. It is possible to migrate from SQL Ce to SQL Server.

Hope that helps,

Joe

1/29/2012 2:02:10 PM
Gravatar
Total Posts 36

Re: SQLCE file sharing error

I suspected something like this. I was hoping to use SQLCE, as it seemed an easier option. I just have to populate the SQL database they provide.

Thanks for all your help.

Barbara

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