Because asp.net membership uses dbo users to access data by default, when deploying memebership to a virtual host, it is usually inaccessible to the specified database, causing memebership to become unavailable, the following describes how to solve this problem and share some personal experience to avoid detours:
1. When you create a memebership database on a VM (dbo users are not provided for basic VM SQL server databases), replace all [dbo] in the SQL scripts of the membership database. and dbo. remove, so that when the membership database is created, all objects will be created using the current connected user.
2. Download the membership source code from microsoft. After the address is critical (recommended), you can go to C: Program FilesASP. NET Provider Toolkit SQL Samples find the source project, add the project to your solution, and reference the project in the project to be used.
3. Rewrite membership, remove dbo from all source code in the memebership project, and regenerate the membership project. In this case, a ProviderToolkitSampleProviders. dll file will be generated under the bin directory of your project.
4. The membership section in the location web. config file is as follows:
<Membership>
<Providers>
<Clear/>
<Add
ConnectionStringName = "MyMemeberShipConnectionString"
EnablePasswordRetrieval = "false"
EnablePasswordReset = "true"
RequiresQuestionAndAnswer = "false"
ApplicationName = "/"
RequiresUniqueEmail = "true"
PasswordFormat = "Hashed"
MaxInvalidPasswordAttempts = "5"
MinRequiredPasswordLength = "4"
MinRequiredNonalphanumericCharacters = "0"
PasswordAttemptWindow = "10"
PasswordStrengthRegularExpression = ""
Name = "AspNetSqlMembershipProvider"
Type