Running Sitecore in Live Mode

Posted on May 13, 2016 by Morten Empeño

By default, Sitecore runs in publishing mode. That means that normally you run a publish process, after you have added or edited content. This is meaningful and relevant for your development and testing environment – and of course also for the production environment. But as a developer, it would be smart to have an opportunity for a local setup, where you are able to make content changes, and see the changes immediately, so that you save time on publishing, clearing site cache etc.

Sitecore in Live Mode

As a developer, we often need to play around with code and content on our local environment. Locally it would make sense to be able to see any content changes immediately, to save time and be more efficient. That is running Sitecore in Live mode. By default you work in the master database and you publish changes to the web database.
That means you work with your content, and when you are ready, you publish to web database, which is the content delivery database Running Sitecore in live mode, can be done by pointing the local website to the master database.

How to

First of all you must be aware that from Sitecore 8.1 and up, sitecore configurations are extracted from the web.config, while if you work on 8.0 and less, the sitecore section lives inside the web.config So there is a difference on where the change needs to be done.
In a custom solution you would want to create a patch file with your custom solution definition, and that is where you will make the change if you run Sitecore 8.0 or less. For a proof of concept, you can do it directly in the web.config file, but it is definitely not a best practice. As of 8.1 and up you can make your change directly in the Sitecore.config file, as it has already been extracted from the web.config so that we have a separate configuration file containing the Sitecore configuration.

Find this node (either in Sitecore.config or web.config):

<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB"/>

And change the value of database=web to database=master:

<site name="website" enableTracking="true" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="master" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB"/>

Now content will be loaded from Master database.
Change some content and save the change. Reload your website.
Changes to any configuration file or the binary folder triggers app pool reset, so page reload will take time.
BAM – you will see the change take effect and now publishing is not necessary.
 

Accessing content directly from Master database

Another way to force content to be pulled from a specific database, is by the use of the sc_database parameter. So for example you can add sc_database=master as a parameter to the url, to enforce content to be pulled from the master database. You must be logged in as a user having read access to do this.

Back to List