Altinet
  • Home
  • Blog
  • Contact





Note to self: Be sure to set asp.net membership defaultProviders

On 29 Mar, 2011
Uncategorized
By : Bruno Samardzic
No Comments
Views : 9629

Man, why do i always have to learn the stuff the hard way?
I was doing a deployment of my RIA solution to the production server after a visual studio update (not sure if it’s connected or not), and i would start getting these strange errors when trying to log in:

There was a failure using the default ‘ProfileProvider’. Please make sure it is configured correctly. The database ‘C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF’ cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported.
Cannot open user default database. Login failed.
Login failed for user ‘NT AUTHORITYNETWORK SERVICE’. InnerException message: The database ‘C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF’ cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported.
Cannot open user default database. Login failed.
Login failed for user ‘NT AUTHORITYNETWORK SERVICE’.

The trouble is, i wasn’t using aspnedb.mdf at all. I figured i would just delete the database and everything would be fine. Then i got this:

Load operation failed for query ‘Login’. Access to the path ‘C:inetpubwwwrootApp_data’ is denied.

Seems that asp.net membership provider is trying to create that ASPNETDB.MDF file on the server although i’ve set it up (or so i thought) to use my database.

My web.config part (the one that’s important) looks like this:

    <profile>
      <providers>
        <add name="CustomizedProfileProvider" type="System.Web.Profile.SqlProfileProvider"
             connectionStringName="database"
             applicationName="/AltiFin"/>
      </providers>
      <properties>
        <add name="FriendlyName"/>
        <add name="BranchGuid" type="System.Nullable`1[System.Guid]"/>
      </properties>
    </profile> 

To cut the long story short, you should ALWAYS set defaultProvider on all the asp.net providers like this:

    <profile defaultProvider="CustomizedProfileProvider"> <!--This part on the left! -->
      <providers>
        <clear/> <!--you should also put this on the left -->
        <add name="CustomizedProfileProvider" type="System.Web.Profile.SqlProfileProvider"
             connectionStringName="database"
             applicationName="/AltiFin"/>
      </providers>
      <properties>
        <add name="FriendlyName"/>
        <add name="BranchGuid" type="System.Nullable`1[System.Guid]"/>
      </properties>
    </profile> 

Otherwise asp.net membership will try to create a default database. just to be safe, you should also put the tag before add, so it doesn’t create the mdf file without you knowing it (like it did on my dev machine). Hope this helps!



Previous Post Next Post 

About The Author

Bruno Samardzic


Number of Posts : 45
All Posts by : Bruno Samardzic

Leave a Comment

Click here to cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>





Recent Posts

  • Angular vs React: round 2
  • Why programming is hard
  • Orchard Workflows, undocumented gem
  • The React Redux
  • React.js invoicing CRUD application, part 2: Description

Recent Comments

  • Angshuman on Animation for starred grid rows and columns using xaml
  • Advanced Excel Training in Lucknow on Angular vs React: round 2
  • Reginald Sophomore on My example of Angularjs directive
  • Slobodan on Angular and Breeze – story so far.
  • Bruno Samardzic on Reaction to Ember-forged Durandal Angularly Knocking out my Backbone, or my JS MVC framework research conclusion.

Contact

Altinet d.o.o.

OIB: 97429091194

Čulinečka cesta 146, Zagreb

Tel: +385 (1) 2946 819

Mob: +385 (98) 210 756

IBAN: HR4323400091110406470

Latest tweets