Views: 3544
Number of votes: 1
Average rating:

Initialize Community 4.0 without IIS


Sometimes you want to initialize EPiServer Community without involving the IIS.  For example when you decide not to use IIS for servicing your web pages or when you want to do unit testing.

Command line program

I've therefore created a little command line program that does this. It initializes Community (and also search) and fetches the first blog post made (ID = 1). You can then use this code as a base for doing your own programs that need access to the Community API.

To use it just compile it and place it amongs a web.config (for a community site) and a connectionstrings.config along with every dll the web.config wants plus the dll's the project needs.





Thanks to Kristoffer @ dev for giving me the inspiration and the file this program was heavily based on!

Jan 21, 2011

Vincent van Ederen
( By Vincent van Ederen, 1/21/2011 7:51:09 PM)

Thank you Thomas, this was exactly what I was looking for!

Jarle Friestad
( By Jarle Friestad, 1/21/2011 10:30:49 PM)

Very cool Tobias. ;-) This is a much smoother way than the hack including reflection that was needed in Community 3.x.

( 1/24/2011 4:24:05 AM)

Nice post Tobias!

Jarle Friestad
( By Jarle Friestad, 1/24/2011 2:31:00 PM)

This code seems only to handle single site installations. It crashes when Initialize(null) is called on SiteMappingConfiguration if episerver.config contains multiple sites. To solve this i just changed the following

new SiteMappingConfiguration().Initialize(null);
SiteMappingConfiguration.Instance.SiteId = "MyRelateSite";

SiteMappingConfiguration.CurrentHostNameResolver = delegate { return ""; };
new SiteMappingConfiguration().Initialize(null);

Please login to comment.