如何成功将ASP.NET网站和SQL Server数据库传输到另一台计算机

时间:2021-08-05 03:31:30

On my home computer, i am working on a ASP.NET Website Project. Which is accompanied with a SQL Server 2012 database.

在我的家用电脑上,我正在开发一个ASP.NET网站项目。其中附带了SQL Server 2012数据库。

I'm trying to transfer this project over to my laptop. I have successfully restored the database on my laptop and fixed some connection errors on the ASP.NET website project (web.config file).

我正在尝试将此项目转移到我的笔记本电脑上。我已成功恢复笔记本电脑上的数据库并修复了ASP.NET网站项目(web.config文件)上的一些连接错误。

In my database i have integrated the aspnetdb to handle my users/roles/membership along with the other tables i have. Unfortunately, after the transferring the entire database over to my laptop it seems to have deleted my roles, but not my users. Therefore, causing a problem when a user tries to login to my asp.net website.

在我的数据库中,我已经集成了aspnetdb来处理我的用户/角色/成员以及我拥有的其他表。不幸的是,在将整个数据库传输到我的笔记本电脑之后,它似乎删除了我的角色,但不是我的用户。因此,当用户尝试登录我的asp.net网站时导致问题。

I have loaded the asp.net website management tool and as i expected it says there are 3 users and 0 roles. I was just going to recreate the roles, as my database isent that big. Strangely enough, the transfer only deleted the roles and not the users. However, upon clicking "create or manage roles" i get an error. Just want to mention same thing occurs when trying to create a new user, using this tool.

我已经加载了asp.net网站管理工具,正如我所料,它有3个用户和0个角色。我只是要重新创建角色,因为我的数据库很大。奇怪的是,转移只删除了角色而不是用户。但是,在单击“创建或管理角色”时,我收到错误。只是想提一下在尝试使用此工具创建新用户时发生同样的事情。

The Error:

错误:

An error was encountered. Please return to the previous page and try again.

遇到错误。请返回上一页,然后重试。

The following message may help in diagnosing the problem: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_roles_manageallroles_aspx.BindGrid() at ASP.security_roles_manageallroles_aspx.Page_Load() at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

以下消息可能有助于诊断问题:建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供者:SQL网络接口,错误:26 - 指定服务器/实例的错误)在System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(布尔isMembership,String methodName,Object []参数,类型[] paramTypes)处于ASP.security_roles_manageallroles_aspx。位于System.Web的System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,EventArgs e)的System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp,Object o)中的ASP.security_roles_manageallroles_aspx.Page_Load()处的BindGrid()。 System.Web.UI.Page.ProcessRequestMain上的System.Web.UI.Control.LoadRecursive()的UI.Control.OnLoad(EventArgs e)(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)

I assume problem lies in me transferring the asp.net website project folder over to my laptop and the asp.net website administration tool cannot recognize the sql server instance, so i need to update this somehow to match the new sql server instance.

我认为问题在于我将asp.net网站项目文件夹转移到我的笔记本电脑和asp.net网站管理工具无法识别sql server实例,所以我需要以某种方式更新此匹配新的SQL服务器实例。

How can i fix my problem?

我该如何解决我的问题?

UPDATE:

更新:

I just checked my home machine database and interestingly enough, there is no data stored in the aspnet_roles table. But there are users stored in the aspnet_users table. Now why is it not storing the roles in that table? :/

我刚检查了我的家用机器数据库,有趣的是,aspnet_roles表中没有存储数据。但是有些用户存储在aspnet_users表中。现在为什么不在该表中存储角色? :/

I'm abit confused, if its not storing the roles in that table.. where would it be storing them?

如果它没有将角色存储在那个表中,那我会感到很困惑。它会在哪里存储它们?

Update 2

更新2

I just noticed the roles are getting stored in app_data folder into ASPNETDB and not the database i have connected on my sql server. I don't know how this has happend as it use to get added to my sql server. is there a way i can transfer my aspnetdb tables and data into my sql database?

我刚刚注意到角色存储在app_data文件夹中的ASPNETDB中,而不是我在sql server上连接的数据库。我不知道这是如何发生的,因为它用于添加到我的SQL服务器。有没有办法将我的aspnetdb表和数据传输到我的sql数据库?

I just did a test by creating a new user. The new user gets stored in my sql database i have. But it does not get stored in the aspnetdb, but the roles are getting stored in the aspnetdb but not the tables in my sql database.

我刚刚通过创建一个新用户进行了测试。新用户存储在我的sql数据库中。但它并没有存储在aspnetdb中,但角色存储在aspnetdb中,而不是存储在我的sql数据库中的表中。

Question: How can i combine these and only have it update data in my sql database?

问题:我如何组合这些并且只在我的sql数据库中更新数据?

Update 3

更新3

I fixed the problem with the roles and users getting stored in 2 diff providers, i just had to point them to a single provider.

我修复了角色和用户存储在2个差异提供程序中的问题,我只需将它们指向一个提供程序。

2 个解决方案

#1


2  

How are you referencing your database? Chances are you have the name of the computer in connections string (or IP address). Check to make sure this is changed as well. THis is most likely in your web.config file. If you still have your old server setup, you can actually export all the tables and records to an sql file and then upload it to the new server.

你是如何引用你的数据库的?您可能在连接字符串(或IP地址)中具有计算机的名称。检查以确保此更改。这很可能出现在你的web.config文件中。如果您仍然使用旧的服务器设置,则可以将所有表和记录实际导出到sql文件,然后将其上载到新服务器。

#2


0  

Here is my "Membership Transfer" Helper.

这是我的“会员转移”助手。

http://granadacoder.wordpress.com/2007/11/29/membershipprovider-helper-to-transfer-data/

http://granadacoder.wordpress.com/2007/11/29/membershipprovider-helper-to-transfer-data/

#1


2  

How are you referencing your database? Chances are you have the name of the computer in connections string (or IP address). Check to make sure this is changed as well. THis is most likely in your web.config file. If you still have your old server setup, you can actually export all the tables and records to an sql file and then upload it to the new server.

你是如何引用你的数据库的?您可能在连接字符串(或IP地址)中具有计算机的名称。检查以确保此更改。这很可能出现在你的web.config文件中。如果您仍然使用旧的服务器设置,则可以将所有表和记录实际导出到sql文件,然后将其上载到新服务器。

#2


0  

Here is my "Membership Transfer" Helper.

这是我的“会员转移”助手。

http://granadacoder.wordpress.com/2007/11/29/membershipprovider-helper-to-transfer-data/

http://granadacoder.wordpress.com/2007/11/29/membershipprovider-helper-to-transfer-data/