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

  • SEARCH
  • Home
  • 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 3237264
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:43:06+00:00 2026-05-17T17:43:06+00:00

After pushing my asp.net mvc (with spark view engine) project to our live server

  • 0

After pushing my asp.net mvc (with spark view engine) project to our live server yesterday I’ve started getting a strange error. Everything works fine initially, but after some time (maybe 30 minutes) the views start throwing “Dynamic view compilation failed” errors and complaining about namespaces not existing. The assemblies for the namespaces listed are in the bin (since it did work initially). I’m using the spark view engine on other websites running on the same box and have never seem this issue. What is causing these views to stop working?

  • 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-17T17:43:07+00:00Added an answer on May 17, 2026 at 5:43 pm

    As qstarin mentioned, recycling the AppPool does seem to kick the assemblies out. Here’s the original Spark discussion regarding the issue:

    http://groups.google.com/group/spark-dev/browse_thread/thread/dbee06a0d1b2766f#

    In general, it seems the issue is caused by Spark trying to compile the views BEFORE the AppPool has had time to load all of the assemblies.

    Picking the assemblies one-by-one still seemed to cause random glitches for me, so I tweaked the code in that discussion post and load it as the first line in Application_Start(). Since then, I’ve pushed out a dozen or so applications over time and haven’t seen the precompile issue once.

    private void PreLoadAssemblies()
    {
        // Deal with the compiling issue with Spark.
        var initialAssemblies = AppDomain.CurrentDomain.GetAssemblies();
        var di = new DirectoryInfo(Server.MapPath("~/bin"));
        var files = di.GetFiles("*.dll");
        foreach (var fi in files)
        {
            var found = false;
            //already loaded? 
            foreach (var asm in initialAssemblies)
            {
                var a = Assembly.ReflectionOnlyLoadFrom(fi.FullName);
                if (asm.FullName == a.FullName)
                    found = true;
            }
    
            if (!found)
                Assembly.LoadFrom(fi.FullName);
        }
    }
    

    and then your Application_Start():

    protected override void Application_Start(object sender, EventArgs e)
    {
        PreLoadAssemblies();
        base.Application_Start(sender, e);
    
        //Whatever else you normally do in Application_Start():
        MvcHandler.DisableMvcResponseHeader = true;
        ViewEngineManager.Configure(ViewEngines.Engines);
        RouteManager.RegisterRoutes(RouteTable.Routes);
        new InjectionManager().StartNinject();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.