简体   繁体   中英

How do I make ASP.NET Roles use MySQL?

I tried following this: ASP.NET Membership/Role providers for MySQL? but I get a SqlException that says "Error locating Server/Instance Specified".

Got any ideas on what I could do?

错误图像

Web.config membership:

<membership defaultProvider="MySqlMembershipProvider">
  <providers>
    <clear/>
    <add name="MySqlMembershipProvider"
         type="MySql.Web.Security.MySQLMembershipProvider,
           MySql.Web, Version=8.0.18.0, Culture=neutral,
           PublicKeyToken=c5687fc88969c44d"
         autogenerateschema="true"
         connectionStringName="localhoststr"
         enablePasswordRetrieval="false"
         enablePasswordReset="true"
         requiresQuestionAndAnswer="false"
         requiresUniqueEmail="false"
         passwordFormat="Hashed"
         maxInvalidPasswordAttempts="5"
         minRequiredPasswordLength="6"
         minRequiredNonalphanumericCharacters="0"
         passwordAttemptWindow="10"
         passwordStrengthRegularExpression=""
         applicationName="/"
 />
  </providers>
</membership>

ConnectionString:

<connectionStrings>
<add name="localhoststr" connectionString="Data Source=localhost;port=3306;Initial Catalog=aspnet;User Id=test;password=test"/>

I had a similar issue and mine ended up being linked to the port being used.

refer to https://blogs.msdn.microsoft.com/sql_protocols/2007/05/13/sql-network-interfaces-error-26-error-locating-serverinstance-specified/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM