Thursday, April 26, 2012

Sharepoint 2007: Event ID 5785

The Event ID 5785, is not much of an issue in terms of site access. It is more an annoying issues that will occur repeatedly and fill the event logs.


Background & Cause

  1. This issues occurs mostly if you have created a Virtual Directory, explicitly under one of the Sharepoint website tied up to a Web application, in order to access a custom application or pages.
  2. In general for a Publishing site, all the content in Sharepoint is saved on the Database. When accessing the site Sharepoint tries to cache the content coming from the database.
  3. Even though Custom application or pages are not part of the Sharepoint set up, Sharepoint will try to cache these contents as well. While caching these content that are external we get the error (ID 5785) "Unable to connect publishing custom string handler for output caching.  IIS Instance Id is '{instance Id}', URL is '{URL of the content that cannot be cached}'."
Solution
  • The simple method to solve this, is to instruct Sharepoint that it can ignore caching these contents.
  • This can be achieved by modifying the Web.config file of he web application in concern.
  • In the web.config file search for the section '<location path="_layouts/images">
  • Copy the complete section from '<location></location>';
  • Paste it above the or below the current Location section, Change the path to point to the custom application or pages page, (relative path to the web application must be given).
  • The content should look as below:
      <location path="{custom application path}">
         <system.web>
           <authorization>
             <allow users="*" />
           </authorization>
         </system.web>
      </location>
      <location path="_layouts/images">
        <system.web>
          <authorization>
            <allow users="*" />
          </authorization>
        </system.web>
      </location>
  • Now add the following tag withing the Location tag created for the custom application or pages.
           <httpModules>
               <remove name="PublishingHttpModule" />
           </httpModules>
  • The final changes will look as below. Save the web.config file.
          <location path="{custom application path}">
            <system.web>
              <authorization>
                 <allow users="*" />
              </authorization>
              <httpModules>
                  <remove name="PublishingHttpModule" />
              </httpModules>
            </system.web>
         </location>
         <location path="_layouts/images">
           <system.web>
             <authorization>
               <allow users="*" />
             </authorization>
           </system.web>
         </location>
Hope this will help you to solve the problem. Have a good day!!! :D