Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6857293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:59:54+00:00 2026-05-27T01:59:54+00:00

I have been working on a project that has common bits of functionality, specifically

  • 0

I have been working on a project that has common bits of functionality, specifically I wanted to share the master file and related images/js/etc. To that end, the master page and its dependent files are all wrapped into a “global” DLL that is utilized by all “subprojects”. This all worked great in development, but deployment yielded a surprise which seems to catch a lot of people off guard: VirtualPathProvider doesn’t work when precompiled.

Now thanks to this blog post containing a workaround I was able to give another attempt at getting it to work. Regretfully, it still doesn’t.

I opted to get rid of my Global.asax implementation and went with the blog post’s AppInitialize approach:

public static class AppStart
{
    public static void AppInitialize()
    {
        HostingEnvironment hostingEnvironmentInstance = (HostingEnvironment)typeof(HostingEnvironment).InvokeMember("_theHostingEnvironment", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null);
        MethodInfo mi = typeof(HostingEnvironment).GetMethod("RegisterVirtualPathProviderInternal", BindingFlags.NonPublic | BindingFlags.Static);
        mi.Invoke(hostingEnvironmentInstance, new object[] { new MasterPageProvider() });
    }
}

Since the actual provider works in debug, I won’t include it. If you would like to see it, don’t hesitate to ask. Just wanted to keep the question as short as possible.

The interesting aspect to this whole situation is that production yields no errors about not being able to find the master page. To me, this means the provider is working, but for whatever reason the rest of the resources (js/css/etc) aren’t being retrieved from the assembly properly.

So my question comes down to this: what are the reasons that this solution would work great in development, but not in production on IIS 7.5?


UPDATE 11/20/2011

Tried out David Ebbo’s suggestion and had no results unfortunately. My web config looks something like this now:

<configuration>
    <connectionStrings>
        <clear />
        <!-- ... -->
    </connectionStrings>
    <system.web>
        <pages>
            <controls>
                <!-- ... -->
            </controls>
        </pages>
        <compilation debug="true" targetFramework="4.0" />
        <webServices>
            <protocols>
                <add name="HttpGet"/>
                <add name="HttpPost"/>
            </protocols>
        </webServices>
    </system.web>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
    </system.webServer>
</configuration>

UPDATE 11/21/2011

Just to verify my suspicion that the VirtualPathProvider was actually working, I commented out the third line (mi.Invoke(....) and redeployed the site. As I suspected, it now breaks due to not being able to find the MasterPage file. This issue appears to be related to only static files being delivered through the VPP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:59:54+00:00Added an answer on May 27, 2026 at 1:59 am

    IIS 7.5 will handle the static files itself. You need to put a line for each static file you want it to ignore in your web.config file to make them get routed through your VPP. See below for examples.

    <system.webServer>
        <handlers>
            <add name="Images" path="*.png" verb="GET,HEAD,POST" type="System.Web.StaticFileHandler" modules="ManagedPipelineHandler" resourceType="Unspecified" />
            <add name="Stylesheets" path="*.css" verb="GET,HEAD,POST" type="System.Web.StaticFileHandler" modules="ManagedPipelineHandler" resourceType="Unspecified" />
         </handlers>
     </system.webServer>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a project that has 2 interfaces - windows forms
I have an Android library project that has been working for me pretty well,
I have been working on a project that requires downloading a zipped file off
I have a project that I have been working on for a while, just
I have a django project that I have been working on as a solo
I have a console project that I have been working on. I added log4net
I have recently been working with someone on a project that is very ajax
I have a project on github that I have been working on before. However,
I have been working on a project for some time, and it has branched
I have a normal VS2008 project that I've been working on for awhile that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.