There are two folders where Litium stores files. The Files Directory and the Common Files directory. Both contains uploaded images, thumbnails, and search indices etc. But the Common files directory is used in multiserver environments, and it stores information that servers would share.
You can set these paths in web.config. By default the Accelerator v 7.2.3 has the filesDirectory set to ..\Files. I do not want it in the project folder but somewhere else on my disk. It is up to you where you want to put it. Do not forget to add it to your .gitignore(or exclude it from your version control) if you keep it in the default folder.
Lets change this:
To this: D:\filefolders\accelerator
(Don’t forget to set permissions to allow the site to save files to it)
To set a commonfilesDirectory you can add it below the filesDirectory in web.config
Lets take a look at using Papercut as SMTP-server during web site development. We’ll also take a look at StateServer. These tools works for any ASP.NET MVC-project but this post is a continuation of the Installing Litium Accelerator post.
Papercut will act as an SMTP-server and will display every email sent from the website we are building. This is how the creators of Papercut explain it:
Papercut is a 2-in-1 quick email viewer AND built-in SMTP server (designed to receive messages only). Not only does it not enforce any restrictions how you prepare your email, but it allows you to view the whole email-chilada: body, html, headers, attachment down right down to the naughty raw encoded bits. Papercut can be configured to run on startup and sit quietly (minimized in the tray) only providing a notification when a new message has arrived.
Now open up web.config of your project and change this:
Next start your site (mine is accelerator.localtest.me) and log in to Litium. Once logged in go to Settings -> Websites -> Websites. Then edit your site and update the Sender email address to an address of your choice.
Litium - Sender email address
Save the settings and order something from the accelerator and you will see an order confirmation email show up in Papercut.
Litium - Sender email address
2. Using StateServer sessionstate
By default the site is setup to use InProc mode. This is fine, But every time the site gets restarted the sessiondata will be lost and we loose information about the cart for example. If we change this to StateServer we save some time every time we rebuild the project since the cart will be saved in our StateServer instead.
Open web.config and change this:
Then start the services app and start the ASP.NET State Service.
At this point I assume you’ve installed the IIS and the .NET framework, the nuget feed, and has created an account that has got download rights for the accelerator. (Linked to in the System Requirements above).
Go to Litium docs - Download and download the accelerator. If you have access to it the package will show up at the top at Latest accelerators. At the time the latest version is Litium Accelerator 7.2.3.
Extract the .zip into a folder where you want to work with the solution.
2. Install via Visual Studio
Open Accelerator.sln after extracting the package.
Go to View -> Other Windows -> Package Manager Console and run the command Update-Package -ReInstall
Wait for install to complete (This took around 3 minutes for me).
Running Update-Package -ReInstall
If you, like me, got an error saying: “Update-Package : Some NuGet packages are missing from the solution. The packages need to be restored in order to build the dependency graph. Restore the packages before performing any operations” Make sure you’ve set up the nuget feed correctly and click the restore button that has shown up at the top of the package manager console. (I had recently changed passwords to my account and needed to update it to get it to work)
3. Configuring the Accelerator
Now right click on the Litium.Accelerator.Mvc-project in the Solution Explorer and click on Set as startup project and run the project.
First run of Litium Accelerator
When the site has started we are redirected to the login page. Login with your windows account (ex: DOMAIN\[email protected] or .\Crille)
Then click on the Cogwheel (top right) -> Deployment -> Accelerator
Select a name and a domain name for the site. I’m using accelerator.localtest.me in this case. By choosing a localtest.me-domain I do not need to add anything to the hosts-file.
Check the Create a set of example products and categories checkbox and the click Import. This will give us some example data.
4. Moving database to Sql Server
By default the accelerator uses a LocalDb instance. Lets move that db to a MSSQLServer instance.
Open Microsoft SQL Server Management Studio as an administrator then right click on Databases and select Attach…
Then click on Add… and select the .mdf -file that is located in the Litium.Accelerator.Mvc/App_Data folder.
Then click ok and attach the database.
When this is done you need to update the FoundationConnectionString in web.config to point to your MSSQL-Instance instead (Not covered here).
5. Adding an IIS site
Next fire up the IIS and right click on Sites and then on Add Website… and select a name.
Point the Physical path to \Src\Litium.Accelerator.Mvc and add the hostname you selected. (in my case http://accelerator.localtest.me/)
You might need to run the Application pool as your local user to get access to the database. But I’ll leave the iis-configuration up to you.
Now browse to the site and you should end up with something like this: