ASP.Net MVC 3 配置
我想问一下 ASP.Net 配置。我有一个使用 ASP.Net MVC3 的项目。我在我的项目中使用会员资格。在我的数据库服务器中,我的项目有 2 个数据库。
- aspnetdb,包含aspnet_membership、aspnet_user、aspnet_roles等(我使用asp.net配置)
- mydatabase,它用于我的项目数据库。
现在,我的老板告诉我,他想公开托管我的项目,并告诉我只使用一个数据库。所以我必须将 aspnetdb 移动到 mydatabase。我怎样才能做到这一点而不在 mydatabase 中创建新表?
谢谢
i want to ask about ASP.Net Configuration. i have a project that use ASP.Net MVC3. and i use membership in my project. in my database server, there's 2 database for my project.
- aspnetdb, contains aspnet_membership, aspnet_user, aspnet_roles, etc (i use asp.net Configuration)
- mydatabase, its for my project database.
now my boss told me that he want to host my project in public and told me to use only one database. so i have to move aspnetdb to mydatabase. how can i do it without making new table in mydatabase ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,ASP.NET 会员资格提供程序使用名为
LocalSqlServer
的内置连接字符串,如下所示:当您第一次使用
Membership
时(或者当您使用Web 配置管理器工具),将自动创建aspnetdb.mdf
。第一步,您可以通过clear
命令从web.config
中删除此connectionString
:此外,您还必须更改
connectionString< /code> 用于
web.config
文件中的membershipProvider
(还有roleProvider
如果您使用它):用于配置数据库以使用 ASP.NET内置会员提供程序,您可以使用regsql工具
可以在此处找到:
在此文件夹中,找到
aspnet_regsql.exe
文件并运行它。将显示一个有用的向导,并且帮助您一步步配置新数据库。关于你的最后一个问题:你不必应用任何更改
到您的 edmx 文件! EF 使用您提供给它的表,并且
membershipProvider
完成其工作ASP.NET 提供给它的表!干得好,干得好!
By default the ASP.NET membership provider uses a built-in connectionString named
LocalSqlServer
which is something like this:and when you use the
Membership
for first time (or when you use the web configuration manager tool), theaspnetdb.mdf
will be created automatically. For first step, you can remove thisconnectionString
fromweb.config
byclear
command:and also, you must change the
connectionString
formembershipProvider
(and alsoroleProvider
if you use it) inweb.config
file:For configure the database to use ASP.NET built-in membership provider, you can use regsql tool
which can be founded here:
In this folder, find the
aspnet_regsql.exe
file and run it. A helpful wizard will be shown andhelp you step by step to configure new database. And about your final issue: You haven't to apply any change
to your
edmx
file! The EF works with tables you supplied to it, andmembershipProvider
do its job withtables that ASP.NET supplied to it! Well done, Good job!
您必须将这些表添加到您自己的数据库中。这很容易。只需使用
aspnet_regsql
工具将数据库架构导出到 SQL 文件并在您自己的数据库中运行该文件。操作说明:
http://www .xdevsoftware.com/blog/post/Install-ASPNET-Membership-Provider-on-a-Shared-Hosting-Company.aspx
You have to add those tables to your own database. It's quite easy. Just use the
aspnet_regsql
tool to export the database schema to a SQL file and run that file in your own database.Instruction:
http://www.xdevsoftware.com/blog/post/Install-ASPNET-Membership-Provider-on-a-Shared-Hosting-Company.aspx