Tuesday, November 30, 2010

Workflow .rules File blocked in SharePoint

We were recently working on a project which stored the Workflow Rules File (with .rules extension) in a SharePoint Document Library. The code programmatically extracted the .rules file from the SharePoint document library and used it further for business logic.


The approach makes the rules configurable, and described here.
http://msdn.microsoft.com/en-us/library/ff986245.aspx

While the code worked in our older MOSS 2007/Win 2003 world, it failed on SharePoint 2010-Win 2008 environment. The error was thrown while trying to access the file through code as well as SharePoint document library UI.

Issue 1: It initially gave a HTTP 404 Not Found Error while trying to access the .rules file

Resolution: .rules extension is blocked by IIS 7. You need to dig IIS log files to realize that its 404.7 error. To resolve, we need to enable .rules extension for our Web App. You can do the same by

a) Using IIS Management Console (inetmgr), Select Web Site, Click ‘Request Filtering’ and remove .rules extension

b) Modify Web.Config using Notepad or Visual Studio and configure fileExtensions node under requestFiltering.


Issue 2: Once the HTTP 404 error is resolved, it throws SharePoint error.

Resolution: In IIS, .rules extension is mapped to System.ServiceModel.Activation.HttpHandler and other handlers.

Using IIS Management Console, select Handler Mappings, and remove the mapping for .rules extension to System.ServiceModel.Activation.HttpHandler

I need to evaluate the impact of removing the handler. To be safe, I have renamed .rules to a dummy value .rules1 so it’s easier to revert. You can also modify web.config handlers node if you are comfortable with same.

Our code is now working after the above changes and  team able to proceed.

1 comment:

Jayvardhan Patil (Jay) said...

Thanks for the information. Apparently the changes look like malicious but I hope those will work for me too.