Running Sitefinity Locally Within IIS

by Gregg Crystal Jan 11, 2017

 

There are many reasons why you may need to run Sitefinity on your local PC.

  1. You don't have the source code, just the deployed files, so you can't run the site within Visual Studio
  2. You want to work on cshtml and CSS changes in the fastest possible way (without having Visual Studio recompile).

Sitefinity can be very SLOW to startup after a build, so we like to minimize the number of times we have to do a complete startup.

When you're running within IIS locally, you can make changes the ResourcePackages folder (for Feather development), change cshtml files in your MVC Views folder, and make CSS changes without having the website startup again.

Remember that Sitefinity is just a .NET website! So if you're familiar with .NET, these steps should be common for you.

Database Setup - SQL Express

Assuming you are using an existing Sitefinity website, then you'll need to restore a backup of that database.

You can use SQL Express 2014. Any database backups you have that are earlier than 2014 (such as 2008R2 or 2012) will restore into 2014.

Make sure SQL Express is setup for remote connections.

Login to your SQL instance with SQL Management Studio, right click on the instance in Object Explorer, and select Properties.

 Running Sitefinity Locally Within IIS

Make sure 'Allow remote connections to this server' is checked.

 Running Sitefinity Locally Within IIS

Now you can restore the database to SQL Express.

Next, Create a Website in IIS

You can install IIS locally on Windows 10.

Once installed, you can add a website within IIS.

 Running Sitefinity Locally Within IIS

Note that we're just going to use localhost as the url, with a port of 8383. I have many sites running locally. The default is port 80, but you can't share ports with more than one website, so in this case I just picked 8383.

Note that the Application Pool automatically named 'sf926200', which is the same name as the site.

Go to Application Pools within IIS and makes sure that you have .NET 4 selected.

 Running Sitefinity Locally Within IIS

Copy Sitefinity Files

Make sure you are copying files from the published version of your site or from the web server and that you are copying to the same folder as you setup within IIS.

Change DataConfig.Config

If you copied from a web server, your database connection strings are probably not going to be the same.

Open Windows Explorer and change this file:

 Running Sitefinity Locally Within IIS

Change the 'ConnectionString' property to point to your local DB.

 Running Sitefinity Locally Within IIS

Run the site - Oops-HTTP Error 500.19!

 Running Sitefinity Locally Within IIS

You can look up the error here.

https://support.microsoft.com/en-us/kb/943891

In my case, I had a rewrite in the web.config that redirected all http traffic to https. My local IIS isn't setup to do this, so I had to comment this code out.

Recycle the Application Pool, and Browse the Site

If you change the web.config, the website will restart automatically.

If you have changes to make in the DataConfig.Config file, the website will NOT automatically restart (even though it feels like it should, since it's a Config file).

Recycling the app pool in IIS will do the trick.