A developer’s first EPiServer CMS project at Sogeti, part 1
These two posts are the base for an introductory EPiServer lab evening I’ll be hosting at Sogeti (or have hosted depending on when you’re reading this). Instead of a PowerPoint-presentation I thought I’d share the EPiServer love here. I appreciate all the feedback I can get!
You’ll learn how to set up an EPiServer CMS project for the first time. The posts detail each installation and configuration step until you have your site up and running with a very simple start page.
They’re not as comprehensive as Frederik Vig’s awesome series Create an EPiServer site from scratch and won’t take you into the depths of design. But instead they go into more detail with the first installation and configuration steps and potential pitfalls you might face.
I’m using the Visual Studio project structure for EPiServer CMS as defined by Ted Nyberg in his post How to set up an EPiServer website which is heavily referenced throughout this post.
OK! Let’s get started!
This post assumes that you’ve installed the following:
- Visual Studio 2008 / 2010 (I’m using Visual Studio 2010 Ultimate Beta 2)
- SQL Server Express 2008
- SQL Server Express 2008 Management Tools
- EPiServer CMS 6 RC1
Installing EPiServer CMS
Open the EPiServer Deployment Center. This is the tool from which we’re installing the website and creating the database. Select “Install site and SQL Server database”.
Next we’ll configure the site. I’ll be using the name of “MyFirstEPiSite”.
Note that the URL that I’ve defined is “local.myfirstepisite” and port “80”. You’ll be unable to reach this URL until we’ve modified the hosts file in Windows. But more on that later!
The next step is to configure the database. I’ll be leaving it as is. Just give the user account that will be accessing the database a password (e.g. Secret123!).
Leave the Optional Modules checkboxes empty. We don’t require any public templates in our site.
We won’t be adding a license file. You can, however, retrieve one from the EPiServer License center.
The installation will now commence and at the end it’ll open a browser session and try to navigate to local.myfirstepisite. Your browser won’t recognize this URL and will return with a “404 Not Found” http error. This is OK.
Modifying the hosts-file
We need to edit our “hosts”-file which will enable us to resolve the URL “local.myfirstepisite” to the IP-adress 127.0.0.1 which is our local computer. You’ll find the hosts file in the folder “c:windowssystem32driversetc”. Open it with notepad (or your favorite text editor of choice).
Now we’ll be able to navigate to the website. But you might hit a snag with this problem.
Enable SQL Server to support mixed mode authentication
Breathe easy. Nothing is wrong with your account (probably! :)). Instead your SQL Server Express installation does not support mixed mode authentication. Let’s get this sorted out.
Open “SQL Management Studio”. Login with your windows account. Right click the root (computer name) in the tree structure and select Properties. Now select the Security page and enable “SQL Server and Windows Authentication mode”. Restart the SQL Server for the changes to take effect.
Refresh your browser and you should see this.
Awesome! 🙂 And it’s true; behind every great… yeah, you get it.
Creating the Visual Studio project
Time to create a new project in visual studio. Choose ASP.NET Web Application as the project template.
Your project will look something like this.
The highlighted areas are files and content that should be deleted. We’ll be copying the source files and configuration files from the EPiServer website installation we performed earlier.
Create the folder structures for “[configuration]”, “[assemblies]” and “Templates” as shown in the image below.
Done? Good! Let’s continue.
Copy the EPiServer CMS files
Navigate to the folder where your EPiServer website was installed by the deployment center. This should be “C:EPiServerSitesMyFirstEPiSite”. We’re interested in the EPiServer CMS binaries. So head into the “bin”-folder and copy all the DLLs to the [assemblies]-folder in our Visual Studio project.
Now add these assemblies you just copied as references in your Visual Studio project.
These files must be copied to the bin folders when you compile the website. So highlight all the EPiServer assemblies you’ve just added as references and set “Copy local” to true.
Copy the configuration files into the three configuration folders: debug, staging and release.
Copy the folders “App_Browsers” and “lang” into your project. Finally the file “global.asax” should be copied as well.
Now your project folder should look something like this.
Add build events to the project
Add the following pre-build event to the project: copy “$(ProjectDir)[Configuration]$(ConfigurationName)*.config” “$(ProjectDir)” /y
Configure the IIS to point to your folder
The IIS is still configured to use the “c:EPiServersitesMyFirstEPiSite” folder. Let’s change this so that the home directory of the website is our project folder. Open the IIS Manager and change this.
Right click “MyFirstEPiSite”, select “Manage Website” and then select “Advanced Settings”. Change the “Physical Path”-property to your development folder.
Build the website and navigate to it
Now build the website and navigate to the URL “local.myfirstepisite”. You should just see a blank page. That’s OK. Navigate to “local.myfirstepisite/MyfirstUI/CMS/admin”. You should be confronted with a login screen. That’s OK. We’re going to enable the site to use the SQL Server providers.