URL rewriting and virtual directories: Error parsing web.config file or assembly not found

Jun 10, 2009 at 12:51 PM


I'm getting an error when using rewriting (with a proxy request) and virtual directories together. My configuration (Windows Server 2003 SP2) looks like this:


  • /web.config with ManagedFusion.Rewiter entries
  • /bin/ with the dll for rewriter

http://MyServer.company/svn > rewritten to http://otherserver.company/svn using a proxy request: this works like a charm

http://MyServer.company/myVirtualDirectory is not rewritten and has it's own web.config. The virtual directory contains some .aspx files and a .svc for a REST data service

  • /myVirtualDirectory/web.config without ManagedFusion.Rewiter entries
  • /myVirtualDirectory/bin without the managedFusion dll but with all the dlls needed by the REST data service

When I call http://MyServer.company/myVirtualDirectory/myDataService.svc (or any other .aspx file) I get an error that "file or assemby ManagedFusion.Rewriter was not found". The source config file shown within the error message is web.config for MyServer.company.

Calling a static .html file does not throw this error.

Well, obviously the ManagedFusion dlls are in the root bin and not in the virtual directory bin. How can I manage this? I can not (and don't want to) add the ManagedFusion dlls to the application bin because this application is deployed by our developers via Visual Studio.

Thanks for your help!




Jun 10, 2009 at 2:07 PM

You are experiencing the common application with in an application problem.  .NET looks at the parent web.config for indications on how children directories should work, the same is true for children applications.  However with children applications the same custom libraries in the parent also need to be with in the child.  Or if you don't want them in there you have to specifically remove them.  In your instance you either need to copy the DLL's to the child application.  Or specifically remove the httpModule in your child web.conifg with <remove name="UrlRewriterModule" />. 

I hope this helped.

Jun 10, 2009 at 2:28 PM


thanks for your quick reply. Since I don't want to add the DLLs to all sub-applications I'm using <remove name="RewriterModule" /> in my child application. That solved my problem!

Is there a way to limit settings from the root application to "this application only" like I can do in NTFS?

Thanks again


Jun 10, 2009 at 3:34 PM

No that is the structure of how .NET application inheritance works in ASP.NET.  The only other way to not have to do this, is create the application outside of the parent application.