如何使ASP.NET角色使用MySQL?

时间:2019-10-14 14:38:40

标签: mysql asp.net authentication asp.net-roles asp.net-authentication

我尝试执行以下操作:ASP.NET Membership/Role providers for MySQL?,但是我收到一个SqlException,提示“错误定位服务器/实例指定”。

对我能做什么有任何想法吗?

Error Image

Web.config成员身份:

<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"/>

1 个答案:

答案 0 :(得分:0)

我遇到了类似的问题,而我最终被链接到了所使用的端口。

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