自动生成的 mysql memebership/profile 和角色提供者表中出现错误
我第一次尝试在 MySQL .NET Connector 6.2.3 中使用内置的成员资格/角色和配置文件提供程序,并且在 web.config 中使用自动生成架构属性。但是,我遇到了一些奇怪的问题。当我在本地运行网站时,我在本地数据库中创建角色、用户等没有问题,但是当我将其部署在我的网络服务器上时,生成的表看起来与本地表不同,并且并非所有表都包含相同的列或使用相同的命名。例如,角色表在本地命名为“my_aspnet_roles”,但在服务器上命名为“my_aspnet_Roles”,并且包含角色名称的列在本地命名为“name”,但在服务器上命名为“Rolename”,这意味着没有一个提供程序在线工作?我有什么遗漏的吗?
这是我的配置文件,其中包含提供程序的所有设置:
<connectionStrings>
<add name="LocalMySqlServer" connectionString="server=127.0.0.1;database=user_test;user id=root;pwd=1234"/>
</connectionStrings>
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<remove name="MySQLMembershipProvider"/>
<add name="MySQLMembershipProvider" autogenerateschema="true" connectionStringName="LocalMySqlServer" applicationName="my_app" passwordFormat="Hashed" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</providers>
</membership>
<profile enabled="true" defaultProvider="MySQLProfileProvider">
<providers>
<remove name="MySQLProfileProvider"/>
<add name="MySQLProfileProvider" autogenerateschema="true" connectionStringName="LocalMySqlServer" applicationName="my_app" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</profile>
<roleManager enabled="true" defaultProvider="MySQLRoleProvider">
<providers>
<remove name="MySQLRoleProvider"/>
<add name="MySQLRoleProvider" autogenerateschema="true" connectionStringName="LocalMySqlServer" applicationName="my_app" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</providers>
</roleManager>
For the first time I am trying to use the build in membership/role and profile provider in MySQL .NET Connector 6.2.3 and I’m using the auto generate schema property in my web.config. However, I’m experience some strange problems. When I’m running the website local I have no problems creating roles, users etc. in my local database, but when I deploy it on my web server the tables generated looks different from the locals and not all tables contains the same columns or use the same naming. E.g. the role table is named “my_aspnet_roles” local but “my_aspnet_Roles” on the server and the column containing the role name is named “name” local but “Rolename” on the server, which means that none of the providers works online? Is there something that I am missing?
Here is my config file with all the setup for the providers:
<connectionStrings>
<add name="LocalMySqlServer" connectionString="server=127.0.0.1;database=user_test;user id=root;pwd=1234"/>
</connectionStrings>
<membership defaultProvider="MySQLMembershipProvider">
<providers>
<remove name="MySQLMembershipProvider"/>
<add name="MySQLMembershipProvider" autogenerateschema="true" connectionStringName="LocalMySqlServer" applicationName="my_app" passwordFormat="Hashed" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</providers>
</membership>
<profile enabled="true" defaultProvider="MySQLProfileProvider">
<providers>
<remove name="MySQLProfileProvider"/>
<add name="MySQLProfileProvider" autogenerateschema="true" connectionStringName="LocalMySqlServer" applicationName="my_app" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</providers>
</profile>
<roleManager enabled="true" defaultProvider="MySQLRoleProvider">
<providers>
<remove name="MySQLRoleProvider"/>
<add name="MySQLRoleProvider" autogenerateschema="true" connectionStringName="LocalMySqlServer" applicationName="my_app" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</providers>
</roleManager>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试最新的 MySQL .NET 连接器版本。 6.3.6
Try latest MySQL .NET Connector, ver. 6.3.6