Tuesday, May 12, 2009

Updated: Standalone apps under Sitecore web root


As this article suggests, it is possible though not officially recommended. Here is an update for what you need to do in Sitecore 6.x to make it happen.

***Updated. (Thanks to the commenters):

The easiest way to do it, especially if you don’t want to inherit anything from the parent Sitecore configuration down to your asp.net app is to use the <location /> config element with inheritInChildApplications="false". With this element you can wrap most config sections like <system.web />, <system.webserver />, etc:

image

It is worth mentioning that not all configuration sections can be wrapped into the <location /> element.

========================================

- Open the web.config of your standalone web app.
- Locate <httpHandlers>section under <system.web> and remove Sitecore specific http handlers:

<httpHandlers>
   <remove verb="*" path="sitecore_media.ashx"/>
   <remove verb="*" path="sitecore_xaml.ashx"/>
   <remove verb="*" path="sitecore_icon.ashx"/>
   ...
</httpHandlers>

- Do the same thing for httpModules section:

<httpModules>
   <remove name="SitecoreHttpModule" />
   <remove name="SitecoreUploadWatcher" />
   <remove name="SitecoreXslWatcher" />
   <remove name="SitecoreLayoutWatcher" />
   <remove name="SitecoreConfigWatcher" />
   ...
</httpModules>

- If you are running on IIS7 in integrated mode, you will need to the same thing for the <system.webServer> section:

<modules runAllManagedModulesForAllRequests="true">
   <remove name="SitecoreHttpModule" />
   <remove name="SitecoreUploadWatcher" />
   <remove name="SitecoreXslWatcher" />
   <remove name="SitecoreLayoutWatcher" />
   <remove name="SitecoreConfigWatcher" />
   ...
</modules>
 
<handlers>
   ...
   <remove name="Sitecore.MediaRequestHandler" />
   <remove name="Sitecore.XamlPageRequestHandler" />
   <remove name="Sitecore.IconRequestHandler" />
   ...
</handlers>
 
- Your standalone app will most likely use its own membership provider(s), so you will need to disable Sitecore membership provider:
<membership defaultProvider="AspNetSqlMembershipProvider">
   <providers>
      <remove name="sitecore" />
      ...
   </providers>
</membership>

- If neither role nor profile providers are used, disable them or if you do use them, add the remove statement the same way as it it shown above for the membership provider.

<profile enabled="false">
   ...
</profile>
<roleManager enabled="false">
   ...
</roleManager>

This way you can easily have an MVC app running in a virtual application (separate pool) of your Sitecore website.

5 comments:

Alexander Kokoshyn said...

Hi Alexander! I was just editing the YAF integration document, and it mentions a standalone application setup as well:
http://trac.sitecore.net/SitecoreYAF/browser/Trunk/Yet_Another_Forum_Integration.pdf?format=raw

The approach given in the doc is different. Does it have any pros or cons compared to yours one?

Yan Sklyarenko said...

Nice article, Alex!

To Alexander: I believe it is just as doing the same things in a bit different way.
Adding inheritInChildApplications="false" to the parent config should affect any child application, but apart from this does the same job.
Regarding membership/roles/profile changes, a number of <remove/> entries is the same as one <clear/> element in each provider group (which is how YAF is configured).

Yan Sklyarenko said...

Alex, thinking a bit more about it gave me an idea that using <clear /> is more preferable than a number of <remove /> elements. There might be not "sitecore" specified as default provider, but also "switcher", or anything else.

Andrew said...

This is great, but one caveat emptor is that you may find that some of the Sitecore functionality may break as a result of this. For instance we had rich text editor control fail to load. Which is a Telerik control and I assume is also a child application which in this case need to inherit Sitecore settings.

Sergejs Kravcenko said...

You'll have a problem related to cache manager, /sitecore/admin/cache.aspx if you sepcifay location and not inheritance in main web.config - cache manager won't functioning.