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

如何使ASP.NET角色使用MySQL?,mysql,asp.net,authentication,asp.net-roles,asp.net-authentication,Mysql,Asp.net,Authentication,Asp.net Roles,Asp.net Authentication,我试着这样做:但是我得到一个SqlException,上面写着“错误定位指定的服务器/实例” 对我能做什么有什么想法吗 Web.config成员资格: <membership defaultProvider="MySqlMembershipProvider"> <providers> <clear/> <add name="MySqlMembershipProvider" type="MySql.Web.Secur

我试着这样做:但是我得到一个SqlException,上面写着“错误定位指定的服务器/实例”

对我能做什么有什么想法吗

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>

连接字符串:

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


我遇到了类似的问题,我的问题最终被链接到正在使用的端口


请参阅类似Sql Server连接字符串的

。我们需要知道您使用的是什么驱动程序才能确定,但在错误消息中使用“Sql Server”似乎证明了这一点。请确保您使用的是
MySql
ADO.Net对象,而不是Sql Server对象。除了为MySql数据库使用正确的格式外,您可能还应该在连接字符串上指定providerName。检查连接字符串。com@mason即使使用此connectionString SERVER=localhost;数据库=aspnet;UID=试验;PASSWORD=test nothing changes您是否按照我的建议更新提供商名称?异常类型表示它使用的是为MS SQL Server而不是MySQL设计的代码。所以您需要找出原因,providerName可能就是它。@JoelCoehoorn正如您在这里看到的,错误来自角色