Copy a LIVE Kentico instance and its database to my local machine

大城市里の小女人 提交于 2019-12-23 02:55:13

问题


The error appears to be this:

ERROR: An error occurred: Folder with default data must exist.

Here are my steps to recreate.

I have read How to Copy Kentico Instance to a Local Machine? and followed all of its steps. It did not resolve my issue. Kentico keeps wanting me to do "Step 1 - Database Instance," and when I go through those steps, I receive the above error.

Here are the steps I took:

Database

  1. Backup the LIVE database.
  2. Restore it locally.
  3. Add the appropriate server logins and database users.

This is how I add the Server Login

USE [master]
GO
CREATE LOGIN [myUser] WITH PASSWORD=N'myPassword', 
    DEFAULT_DATABASE=[master], 
    CHECK_EXPIRATION=OFF, 
    CHECK_POLICY=OFF
GO

ALTER SERVER ROLE [sysadmin] ADD MEMBER [myUser]
GO

Here is how I configure my database user

CREATE USER [myUser] FOR LOGIN [myUser] WITH DEFAULT_SCHEMA=[dbo]
GO

Here are the assigned database roles

GO
ALTER ROLE [db_owner] ADD MEMBER [myUser]
GO
ALTER ROLE [db_ddladmin] ADD MEMBER [myUser]
GO
ALTER ROLE [db_datareader] ADD MEMBER [myUser]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [myUser]
GO
ALTER ROLE [db_owner] ADD MEMBER [myUser]
GO
ALTER ROLE [db_owner] ADD MEMBER [myUser]
GO
ALTER ROLE [db_owner] ADD MEMBER [myUser]
GO
ALTER ROLE [db_datareader] ADD MEMBER [myUser]
GO
ALTER ROLE [db_datawriter] ADD MEMBER [myUser]
GO
ALTER ROLE [db_owner] ADD MEMBER [myUser]
GO

Code Base

  1. Checkout the existing code base locally.
  2. Setup IIS to host the existing code base.

web.config

Change the connection string to point at my local SQLExpress

<add name="CMSConnectionString"
     connectionString="Persist Security Info=False;
                       database=MyKentico;
                       server=.\SQLEXPRESS;
                       user id=myUser;
                       password=myPassword;
                       Current Language=English;
                       Connection Timeout=240;" />

hosts

Add the following entry:

127.0.0.1     ca.myKentico.local

Result

When I go to ca.myKentico.local, the following screen appears.

So, I click Next, and the following screen appears.

Next.

At this point, there is an error message at the bottom of the screen.

ERROR: An error occurred: Folder with default data must exist.


回答1:


Please try a connection string like this to see if it works:

<add name="CMSConnectionString" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=Kentico82;Integrated Security=False;User ID=MyUser;Password=MyPassword;Connect Timeout=240" />

Thanks.

It also might be that you recreated your db schema locally without adding the data. Run the following query to make sure that you have local data.

SELECT *
FROM [dbo].[CMS_UIElement]

If there's no data in there, then you don't have an admin user interface. You'll need to run import the data from your LIVE database into your local one.




回答2:


If you had a working copy prior and set it up in a different/new environment and the first page you see on initially accessing the site is the install page, it's because the connection string is:

  • missing
  • incorrect

If your connection string is correct and your user does not have permissions you will receive a page stating the use does not have permissions. So you are not even connected quite yet.

When entering your connection string in the web.config, enter it all on one line (yes I know you can do it as you show, but humor me) and ensure your string is:

  • formatted correctly for SQL Express
  • named "CMSConnectionString"

After you have confirmed those items, recycle the websites AppPool and try again.



来源:https://stackoverflow.com/questions/29710560/copy-a-live-kentico-instance-and-its-database-to-my-local-machine

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!