7

We've been working on an application that quite heavily relies on VirtualPathProviders in ASP.NET.

We've just come to put the thing on a live server to demonstrate it and it appears that the VirtualPathProviders simply don't work when the site is pre-compiled!!

I've been looking at the workaround which has been posted here: http://sunali.com/2008/01/09/virtualpathprovider-in-precompiled-web-sites/, but so far I haven't been able to get that to work, either! (Well - it works fine in visual studio's web development server - just not on our IIS box - again!).

Does anybody here have any more information on the problem? Is it fixed in .NET v3.5 (we're currently building for v2.0)?

burning_LEGION
  • 13,246
  • 8
  • 40
  • 52
Chris Roberts
  • 18,622
  • 12
  • 60
  • 67

1 Answers1

4

Unfortunately that is not officially supported. See the following MSDN article.

If a Web site is precompiled for deployment, content provided by a VirtualPathProvider instance is not compiled, and no VirtualPathProvider instances are used by the precompiled site.

The site you referred to is an unofficial workaround. I don't think it's been fixed in .NET 3.5 SP1

Haacked
  • 58,045
  • 14
  • 90
  • 114
  • I can see why you can't precompile content provided by a VirtualPathProvider, but I can't see why you can't use it at all. Do you know a reason for this limitation? – Troels Thomsen Aug 06 '09 at 14:38
  • @Haacked see here: http://blogs.msdn.com/b/davidebb/archive/2005/11/27/497339.aspx No ideas if it's fixed in .NET 4 or 4.5 though... – Jamie Howarth Feb 07 '13 at 15:50