Search code examples
asp.netiis-6virtualpathprovider

Custom VirtualPathProvider not being used in IIS6


I added the following lines to Application_Start method in global.asax:

var provider = new TestVirtualPathProvider();
HostingEnvironment.RegisterVirtualPathProvider(provider);

Yet the 'TestVirtualPathProvider' is never used when deploying this application in IIS6 (it does in the ASP.NET Development Server).

Edit: the default path provider has always done its job correctly and served (non-embedded) views correctly. The problem is simply that I want to use my own path provider to provide embedded views. So, initially, I already had the following wildcard mapping configured:

Used wildcard mapping screenshot

Any possible reasons why this does not work in IIS6? Are there any other factors (handlers for example) wich might influence the used VirtualPathProvider?


Solution

  • For the combination Custom VPP + IIS6 + Precompiled site, we need to add the VPP from AppInitailize();

    public static class AppStart
    {
        public static void AppInitialize()
        {
        // code to be executed automatically by the framework
        }
    }
    

    See also:

    http://sunali.com/2008/01/09/virtualpathprovider-in-precompiled-web-sites/