Membership Database – aspnetdb.mdf

Discussion in 'General troubleshooting' started by TennChris, Jan 29, 2011.

  1. I have built a standard Silverlight BusApp (from the wizard in VS 2010) and am working through the example on:
    “Walkthrough: Using Authentication Service with Silverlight Business Application”

    Everything works fine on my local machine, including the authentication functions.

    Now have this app installed on my Winhost account with the exception of the Membership Database (aspnetdb.mdf, which is currently on my local machine in my web project; App_Data folder). Since, the Membership Database is not installed, I’m receiving the message:

    “There was a failure using the default ‘MembershipProvider’. Please make sure it is configured correctly. Could not find stored procedure ‘dbo.aspnet_CheckSchemaVersion’. Inner exception message: Could not find stored procedure ‘dbo.aspnet_CheckSchemaVersion’.”

    I have tried to follow the steps in the Winhost KB:
    How to configure the ASP.NET Membership/Roles Provider
    but I’m not getting much success here.

    I believe I have the connection string correct in my Web.Config file.
    <clear />
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer"
    Integrated Security=false;Initial Catalog=DB_16199_advworks;
    User ID=DB_16199_advworks_user;Password=MyPasswordHere" providerName="System.Data.SqlClient" />

    I have also read:

    My questions are:

    1. How should I install the Membership database – aspnetdb.mdf?
    a. Should I just create it in the same way I did the AdventureWorks db? ( )
    b. Do I use up one of my SQL databases in my account?

    I kinda need the whole picture followed by some specifics.

    Thanks very much. - Chris
    Last edited by a moderator: Oct 14, 2015
  2. I had the same problem and since I only get one database with my plan I just copied the membership tables into my main database and modified the connection string. It works fine.
  3. Ray


    It sounds like you didn't run the aspnet_regsql command on your database. This creates the membership/provider tables and all the objects it needs to store your login and password of the forms.

    Did you run these commands?

    Open the command prompt on your local computer, and navigate to: C:\WINDOWS\Microsoft.NET\Framework\[framework version]

    Execute the command: aspnet_regsql.exe -S DBServerName -U DBLogin -P DBPassword -A all -d DBName
  4. Thanks (to both of you). After experimenting some more here is some additional information, especially regarding the ”–E” and “–sqlexportonly” options on the aspnet_regsql.exe utility. This reply is not a question, but rather just posting my finding for future viewers.

    I experimented with putting Membership data on the remote server in a few ways.
    1. Either put the aspnetdb structures directly into my SQL database (as mentioned above), or
    2. Create a separate aspnetdb SQL database.

    I did both and in either case the connection name ‘LocalSqlServer’ must reference the SQL Database where the aspnetdb data is located.

    To get the aspnetdb structure into my SQL database there are two methods. And here is a good link:

    1. Is to use aspnet_regsql.exe to add ‘aspnetdb’ to your local sql server database (mentioned in prev post). But, I use Windows Authentication on my local sql server, so my command from the command prompt to directly add aspnetdb structures into my DB (AdventureWorksLT) was:

    aspnet_regsql.exe –S [MyLocalSQLServerName] –E –A all –d AdventureWorksLT

    Helpful Hint: Opening a Visual Studio 2010 command prompt allowed me to get to the folder C:\Windows\Microsoft.NET\Framework\v4.0.30319. To open the VS command prompt; in the Start;Run window, just type in “command” and wait for the automatic search to show options.

    2. There is another option on aspnet_regsql.exe which is useful. It is
    –sqlexportonly <filename> . This option creates a script to add aspnetdb structures to the SQL DB. Since I had already uploaded my SQL DB, I opened a connection to my remote SQL DB and opened my script created from this option.

    aspnet_regsql.exe –S [MyLocalSQLServerName] –E –A all –d AdventureWorksLT –sqlexportonly [MySQLScript]

    Before running the script, I did a find/replace on my local SQLDBName and replaced it with "DB_16299_advworks". 12 replacements. Ran the script. Done.

Share This Page