不同开发计算机上的 ASP.NET 成员资格提供程序
“asp.net 会员提供商”可移植吗? 我是否必须运行 aspnet_regsql.exe 才能为每台新计算机进行设置?
我将成员资格提供程序数据库导入到 Visual Studio Database Edition 并签入我的源代码管理,并将其重新部署到不同的开发计算机。 从新机器上,我收到以下错误。 我该如何解决? 谢谢!
的 'System.Web.Security.SqlMembershipProvider' 需要兼容的数据库模式 架构版本“1”。 但是,那 当前数据库架构不是 与此版本兼容。 您可以 需要安装兼容的 带有 aspnet_regsql.exe 的架构 (在框架中可用 安装目录),或升级 更新版本的提供程序。
Is the "asp.net membership provider" portable? Do I have to run the aspnet_regsql.exe to set it up for every new machine?
I imported the membership provider database to Visual Studio Database Edition and checked into my source control, and redeployed it to a different dev machine. From the new machine, I got the following error. How do I fix this? Thanks!
The
'System.Web.Security.SqlMembershipProvider'
requires a database schema compatible
with schema version '1'. However, the
current database schema is not
compatible with this version. You may
need to either install a compatible
schema with aspnet_regsql.exe
(available in the framework
installation directory), or upgrade
the provider to a newer version.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只要您在新的开发环境中拥有 Framework 2.0 或更高版本并可以访问包含架构的数据库,它就是“可移植的”。
aspnet_regsql.exe 应用程序仅用于生成数据库架构。 真正的事情发生在 web.config 中指定您的提供商时。
只要连接字符串或包含成员资格提供程序架构的数据库中有 .mdf 文件引用,一切都应该正常工作。
连接字符串:
会员提供者:
It is "portable" as long as you have Framework 2.0 or upper in the new dev environment and access to the DB containing the schema.
The aspnet_regsql.exe application is only for generating the db schema. The real deal happens in the web.config when specifying your provider.
As long as you have the .mdf file reference in the connection string or the DB containing the membership provider schema, everything should work fine.
Connection String:
Membership Provider:
每个数据库都需要 SQL 成员资格提供程序。 提供者注册过程在数据库中创建某些表。 如果这些表不存在,您将收到上述错误。
由于表是在数据库中创建的,因此您可以拥有任意数量的不同应用程序或开发计算机来共享单个 SQL 数据库。
但是,如果您想要另一个提供程序实例,因为您有不同的应用程序或需要与另一个 SQL 数据库通信,那么您需要再次注册(创建表)。 另一种可能性是使用 SQL 复制将表从一个数据库复制到另一个数据库。
您的应用程序可能需要修改 web.config 文件以确保它具有与现有 SQL 数据库的正确连接字符串。
The SQL membership provider is needed for every database. The provider registration process creates certain tables within the database. If those tables are not there, you'll get the errors above.
Since the tables are created in the database, you can have as many different applications or development machines as you want to share the single SQL database.
But if you want another provider instance, because you have a different application or need to talk with another SQL database, then you'll need to register (create the tables) again. Another possibility would be to use SQL replication to copy the tables from one database to another.
What is likely is that your application needs to modify the web.config file to make sure it has the right connection string to an existing SQL database.
我也有这个问题。 对我来说,我必须明确地给我的应用程序命名(在我的开发机器上是“/”)。
web.config:
然后在我的数据库中:
I had this problem too. For me, I had to explicitly give my application a name (it was "/" on my dev machine).
web.config:
And then in my database: