Windows – Access is denied while processing web.config with Sql Server Compact

web-hostingwindows

I just deployed an ASP.NET MVC3 site to a new hoster. It is using the Plesk Control panel. The site is using Sql Server Compact 4.0 and EricEJ's Sql Server Compact Membership and Role provider.

When trying to access the site, I'm getting an access is denied error on the web.config file where I add the SqlCeMembershipProvider:

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Source Error:

Line 31:         <clear /> 
Line 32:         <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> 
Line 33:         <add name="SqlCeMembershipProvider" type="ErikEJ.SqlCeMembershipProvider, ErikEJ.SqlCeMembership" connectionStringName="SqlCeServices" applicationName="/" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" writeExceptionsToEventLog="false" /> 
Line 34:       </providers> 
Line 35:     </membership>

The SqlCeServices connection string is configured like this:

<connectionStrings>
    <add name="SqlCeServices" connectionString="data source=|DataDirectory|\SqlCeAspnetdb.sdf" />
</connectionStrings>

When I go to the "File Manager" in the Plesk control panel, and click on "change permissions" for the "App_Data" folder, all the users (that I can configure) have write and modify permissions:

permissions for app_data

Although, when I click the "advanced" button, this is what I see:

advanced permissions for app_data

The entry on the bottom for "Plesk IIS WP User (IWPD_321)" has all the permissions. But apparently, there are 2 additional entries for that same user on top. These don't have write permissions, but anything I change for those 2 doesn't get saved. When I come back to the screen, they are again as shown (without write permission).

I'm not sure what I can do, or what I have to ask the helpdesk of the hoster to get this solved (they don't seem to have experience with Sql Server Compact).

I tried removing the lines from web.config where the SqlServerCe Connection string is used, and then I can run the site, but I can't create (register) users or roles, as I don't have a Sql Server database.

Any suggestions on what to try next?

Best Answer

I found the solution. I needed to add "Read/Execute" rights to the \bin folder and all its child objects for the "Plesk IIS WP User (IWPD_321)" user.

The \bin folder is where the Sql Server Compact binaries reside.

Guess I was focusing on the \App_Data folder too much...