Installing RazorPub

Installing RazorPub

Installing RazorPub is not too difficult for most developers, but it is not something for everyone.

  • RazorPub requires the UrlRewrite Extension. Get this installed on your web server before you get started.
  • Edit the web.config with your details.
  • Changing the username and password is most important.
    • Editing the default information in the appSettings.
    • Copy the Webroot to your server and add site in IIS. If you prefer to install it in a folder as a virtual application, see the details below for configuring as a virtual application.
  • Add write access to the Files folder.
  • Open the site to confirm it is displaying.

Configuring as a Virtual Application

RazorPub can be configured as a virtual application if you want to set it up a folder like /blog/ from the web.config.

RazorPub can be configured as a Virtual Application so you'd be able to use it alongside your existing websites. For example if you've got a running ASP.NET website at http://yourexamplesite.com/ and you want to setup a blog under /blog/ path, you could setup http://mysite.com/blog/ with a few simple tweaks in web.config settings:

  • Set blog:path element of appSettings to the virtual path that you've configured for RazorPub. Example with path blog
<add key="blog:path" value="blog"/>
  • Update the path attribute of all the <handlers> in web.config. Example with path blog
<handlers>
    <remove name="PostHandler"/>
    <add name="PostHandler" verb="POST" type="PostHandler" path="/blog/post.ashx"/>
    <remove name="FeedHandler"/>
    <add name="FeedHandler" verb="GET" type="FeedHandler" path="/blog/feed/*"/>
    <remove name="CssHandler"/>
    <add name="CssHandler" verb="GET" type="MinifyHandler" path="/blog*.css"/>
    <remove name="JsHandler"/>
    <add name="JsHandler" verb="GET" type="MinifyHandler" path="/blog*.js"/>
</handlers>

<httpErrors>
    <remove statusCode="404"/>
    <error statusCode="404" responseMode="ExecuteURL" path="/blog/404.cshtml"/>
</httpErrors>

After changing the config all that is left is configuring a Virtual Application with the same path(ex. blog) inside your IIS website.