Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Windows Server 2003, IIS6.

We're trying to deploy a non-MVC ASP.NET web application as a subdirectory of an MVC application.

However the ASP.NET application in the subdirectory is failing with the message "Could not load file or assembly 'System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified." which is bizarre because it's not an MVC application.

share|improve this question

Need more information:

  1. Is the child (sub-folder) ASP.NET web application running in its own IIS Application, or in the parent's IIS Application?

  2. Where is System.Web.Mvc.dll deployed?

If #1 is false (i.e. same IIS Application) then the requirement for System.Web.Mvc is being inherited from the parent web.config.

share|improve this answer
1. It's in its own application. We tried setting the folder as an application, and also moving the folder to a separate path and creating a virtual directory. 2. It's installed on the server, so it's in the GAC. – David May 9 '10 at 15:21
up vote 0 down vote accepted

We wound up not solving this problem, because we ran into a different but related problem. Since the paths in our MVC application do not use file extensions, we had to install a wildcard mapping, which we believed would prevent the subdirectory website from functioning.

So we punted and moved the sub-application to a subdomain and added a redirect for that subdirectory in the parent application's routes.

share|improve this answer

I have just encountered the same error for a different assembly in a very similar situation:

  • IIS 8.5
  • a site running an ASP.NET MVC application
  • a virtual application underneath it, called app, in our case also an MVC app

In our case, though, the virtual application failed to load because Microsoft.Owin.Host.SystemWeb.dll version could not be loaded. We actually had version sitting there but even with an assembly redirect in the web.config this would not help. It was the root application that was using version

Running the virtual application underneath an empty site (simply pointing to an empty folder) worked, though. Also, running it as its own site worked as well.

Since I couldn't get the error fixed with the given setup, I came up with a different solution: hosting the root app as a virtual application, as well.

Now, this implied running inside a virtual folder, let's call it w. The missing part in the puzzle was now a rewrite rule to map the site root to that virtual folder w. I put this rule into a new web.config file in the empty site root folder. This is what it looks like:

<?xml version="1.0" encoding="UTF-8"?>
        <rule name="Rewrite / to /w" stopProcessing="true">
          <match url="^$" />
          <action type="Rewrite" url="/w" logRewrittenUrl="true" />
        <rule name="Rewrite rest to /w/rest" stopProcessing="true">
          <match url="^(/.*)$" />
          <action type="Rewrite" url="/w{R:0}" logRewrittenUrl="true" />
            <add input="{REQUEST_URI}" pattern="(^w$|^w/)|(^app/)" negate="true" />

As you can see, it's actually two rewrite rule because I couldn't quite get it to work with only one. In the second rule you can see that I exclude app from rewriting because that's where my other application lives.

Here's what we have:

  • requests for get rewritten to and subsequently processed by our first virtual application w which used to be our root application
  • requests for are handled by our virtual application app as expected

I'm currently still fighting with some static file paths not being properly rewritten, but I expect to get this fixed soon.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.