如何在没有 Visual Studio 的情况下在生产服务器中有效设置 MySQL 用户和角色?
到目前为止,我一直在使用 Visual Studio 2010 中内置的网站管理工具来管理用户和角色以及 MySQL 成员资格和角色提供程序。
现在,我已将应用程序部署到生产服务器,但收到以下错误:
即使我尝试将角色之一和用户之一从本地数据库复制到生产服务器使用的数据库,但它不太有效,并且我不断收到相同的错误。至少,我确信这是错误的原因,因为我进行了远程调试,这让我找到了它。
此时我对如何使其正常工作感到非常困惑。因此,任何帮助或指导将不胜感激。
编辑:此时,用户已在登录页面中使用生产数据库服务器的连接字符串进行了身份验证。出于这个原因,我已经排除了与连接字符串相关的任何类型的问题。我在加载需要角色的母版页时收到此错误,以便选择要显示的菜单。
So far I have been using the WebSite Administration Tool built in Visual Studio 2010 to manage Users and Roles along with MySQL Membership and Roles Provider.
Now, I have deployed the application to the production server and I am getting the following error:
Even if I tried to copy one of the roles and one of the users from my local DB to the one used by the production server, it didn't quite work and I keep getting the same error. At least, I'm sure that's the cause of the error because I did a remote debugging which led me to find it.
At this point I am very confused on how to get it working properly. So, any help or guidance would be really appreciated.
EDIT: At this point the User has been already authenticated in the login page using the connectionString to the production DB server. For that reason, I have dismissed any kind of problems related to the connectionString. I get this error while loading the masterPage where the role is needed in order to choose which menu to display.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
异常消息说明了一切:它无法连接到数据库。验证您的生产数据库服务器是否正在运行、连接字符串是否正确以及您是否具有从 Web 服务器到数据库服务器的网络连接(包括名称解析)。
The exception message says it all: It cannot connect to the database. Verify that your production DB server is running, that the connection string is correct and that you have network connectivity (including name resolution) from the web server to the DB server.
这个问题的解决方案是通过 machine.config 授予完全访问权限并自动生成架构来创建 mysql_aspnet_membership 提供程序,而不是在数据库中手动创建成员资格表,我认为这可能是创建数据库的有效方法。
后来这个就没有再断过。
The solution for this problem was to create the mysql_aspnet_membership provider by granting full access through the machine.config and autogenerating the schema, instead of manually creating the membership tables in the database, which I though there could have been a valid way to create the db.
Afterwards, this didn't break anymore.