Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:17:21+00:00 2026-06-12T16:17:21+00:00

So. At first, i added connection string to remote server MSSQL Server 2008 R2,

  • 0

So.

At first, i added connection string to remote server MSSQL Server 2008 R2, 10.50.1600:

<add name="MySQLConnection" connectionString="server=xxx.x.xx.xx;initial catalog=xxxxx;user id=sa;password=xxxxxxxxxxx;"/>

Then, i configured that remote database using aspnet_regsql in .NET 4.0 on server side and add custom membership (because inbuild didn’t want to work with WSAT).

<membership
  defaultProvider="SqlProvider"
  userIsOnlineTimeWindow="20">
  <providers>
    <clear />
    <add name="SqlProvider"
        type="System.Web.Security.SqlMembershipProvider"
        connectionStringName="MySQLConnection"
        enablePasswordRetrieval="false"
        enablePasswordReset="true"
        requiresQuestionAndAnswer="true"
        passwordFormat="Hashed"
        applicationName="/" />
  </providers>
</membership>

So, now i can configure my application with WSAT, but can’t enter on login or register page, get error:

System.ArgumentException: Invalid value for key 'attachdbfilename'.

Line 32:                     using (var context = new UsersContext())
Line 33:                     {
Line 34:                         if (!context.Database.Exists())
Line 35:                         {
Line 36:                             // Create the SimpleMembership database without Entity Framework migration schema

SOLVED:

The problem was here:

public class UsersContext : DbContext
{
    public UsersContext()
        : base("DefaultConnection")
    {
    }

    public DbSet<UserProfile> UserProfiles { get; set; }
}

I dont need custom membership e.t.c.- just to set for my connection string current DefaultConnection name, or change here to MySQLConnectionString.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:17:23+00:00Added an answer on June 12, 2026 at 4:17 pm

    attachdbfilename is not valid for remote databases. It says your connection name is MySQLConnection, but in your membership you specify a connection string of “dbSkazkiEntities”.

    Are there more than one connection string?

    EDIT:

    Wow. Ok, you have a ton of things messed up here. First, you are using SimpleMembership. SimpleMembership does not use a Membership provider configured in your Web.Config. It does absolutely nothing.

    Second, SimpleMembership is configured in the Filters\InitializeSimpleMembershipAttribute.cs file, in there is a line that says:

    WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", 
        "UserName", autoCreateTables: true);
    

    The first parameter tells SimpleMembership which connection string to use, and it’s called DefaultConnection. DefaultConnection is a fallback connection defined in machine.config, and this connection uses a localdb by default, which has the attachdbfilename attribute.

    You need to change the line above to be your MySQLConnection instead, and get rid of the MembershipProvider you created.

    Next up is that the UsersContext is defined with a default connection string as well. Change that as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble changing the connection string used by entity framework code first
I am using EF 4.1 Code First with SQL Server 2008 R2. I have
Documentation says Dictionary keys order is unspecified. I guess it means the first added
I've added my first OneToMany relationship to my hibernate 3.6.10 project. Here is the
I have added one view controller to my first view controller as aa subview
I edited epoc.ini added textshell in the first line. When I run from the
I'm developing my first Word 2007 addin, and I've added an OfficeRibbon to my
I have a table. Some rows are dynamically added by jquery. The first <td>
Totally n00b question, Im making my first ASP.NET website, with the added twist of
I am developing a C# VS 2008 / SQL Server website application. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.