If your Pre-Compiled Website uses custom Virtual Path Providers and Resource Providers both serving content from the application database, you may run into a series of issues. I will try to highlight a few hacks and workarounds to get the website to a working state.
Fritz Onion’s January 2006 article in the MSDN Magazine’s Extreme ASP.NET column is a very good start to understand ASP.NET Pre-Compilation model. The summary of the article is this very table found in the MSDN magazine article.
The full article can be read here.
Making Virtual Path Providers work with Pre-Compilation:
This is not officially supported by Microsoft, so use this at your own risk.
The first hack is about registering the Custom Virtual Path Provider with the Hosting Environment using private reflection detailed in Coskun SONALI’s article here.
If you deploy the Web Site in the ‘All Binary’ mode, you will be greeted with the error ‘The file <your file served by the virtual path provider> has not been pre-compiled, and cannot be requested.’. It turns out that pre-compilation module was looking into a file called PreCompiledApp.config. If you just flip the updateable flag to true (after the all binary pre-compilation) and it should start working.
Making custom Resource Providers work with Pre-Compilation:
The pre-compiled site should be working but some of the resource expressions may not be working and you may be having blank instead of the resource string values in the labels and other text controls. To be more precise Explicit Resource Expressions will be working whereas Implicit Resource Expressions will not be. Rick Strahl’s blog talks about the Implicit Resource Provider interface IImplicitResourceProvider. Implementing one you can get the Implicit Resource reference in expressions also working in a pre-complied web site.
Resource Providers are invoked at compile time as well and not surprisingly Rick Strahl has blogged about the same here.