2

TLDR see below line

In my attempt to enable Roles, I've had nothing but one hurdle after another. As soon as I sort on out, there's another one. I'm at my wit's end.

I'm using code first migrations in VS2015 Enterprise with MSSQLServer 2014. I've added the express tag, as it is in the error message. My site is hosted by smarterasp.net.

These have been my latest troubleshooting steps to lead me to where I am now:

I have gone from this:
"The certificate chain was issued by an authority that is not trusted" when connecting DB in VM Role from Azure website

To this:
How can I create a local user profile for the anonymous user of an ASP.Net MVC application under IIS 7?

To this:

Access denied creating App_Data subdirectory Description: For security reasons, the identity 'NETWORK SERVICE' (under which this web application is running), does not have permissions to create the App_Data subdirectory within the application root directory. ASP.NET stores the Microsoft SQL Express Database file used for services such as Membership and Profile in the App_Data subdirectory of your application.

I've included a screenshot from part of this page:

enter image description here

Now the instructions on that error page are clear, I had already followed the MSDN instructions on this, I even set it to allow modify (frantic stabs in the dark)

So my:

  1. Visual Studio folder gives NETWORK SERVICE read permissions.
  2. Project Name (under the Visual Studio/Projects/Project Name) folder provides NETWORK SERVICE modify, read&execute, read and write permissions.
  3. Likewise, the App_Data folder does the same.

enter image description here

In my web config I have:

<roleManager
    enabled="true"
    cookieName=".ASPXROLES" cookieTimeout="30"
...
    defaultProvider="AspNetSqlRoleProvider">
</roleManager>

<entityFramework>
<providers>
  <provider invariantName="System.Data.SqlClient" 
    type="System.Data.Entity.SqlServer.SqlProviderServices, 
        EntityFramework.SqlServer" />
</providers>

I have no idea what I'm doing wrong.
Any help is appreciated.



edit
I'm banging my head against a wall.

I think this is the problem, there is a read only property checked on the App_Data folder, when I go into the settings for this and the mdf and log files within it, they all have read and write access and full control on the user account.

I have disabled inheritance from parent folders.
Tried propagating inherited properties from parent folders. I've checked my server allows remote connections and any permissions I can find anywhere in IIS, SqlServer, the folders and it's driving me crazy.

I can't get this read only property unchecked.

enter image description here

Community
  • 1
  • 1
  • Are you getting the error on your local machine with IIS Express ? Or on your local machine with IIS ? Or on your smarterasp.net host ? – personne3000 Sep 26 '15 at 07:14
  • And you are changing the folder permissions on the host right ? Through remote desktop or something ? I don't know smarterasp.net. Also I believe it is the permissions of the parent folder that you need to edit if you want to allow creation of a subdirectory as mentioned in the error message. – personne3000 Sep 26 '15 at 08:02
  • I believe you just solved this problem then ! Unfortunately you just bumped into another... You should probably ask another question. The SQL server file in the app_data directory may be something specific to your host though, SQL server generally runs independently from ASP.NET with different folders. – personne3000 Sep 26 '15 at 08:49
  • Okay, are you sure you want to use an SQL express file from the App_Data directory as your database in the first place ? From what I can see on the smarterasp.net website, hosting comes with full SQL server instances, not just SQL Server express – personne3000 Sep 26 '15 at 09:08

1 Answers1

0

It works when I comment out this:

<authorization>
    <allow roles="*" />
....
</authorization>

And the page it is going to, is probably a misdirection for what I actually need to do. As I read it was not good to upload your app data.

And it's working when I take that out. I need to fix up my authorization, so users can land on the site and login, rather than locking at all down to admin only. There was no provision to allow anonymous to actually land on the site.

Because there was no provision to land on the site without authentication, it was looking for a local db.

I want to thank https://stackoverflow.com/users/734151/personne3000 for directing me to the host server files, as I'd neglected to check them at the server site and was only doing so over filezilla and there were two different things there.

Community
  • 1
  • 1