2

I'm getting this problem on a very specific page and I'm not sure how to fix it. I've already found several SO questions (such as ASP.NET corrupt assembly "Could not load file or assembly App_Web_*" and Could not load file or assembly App_Web_xxxxxxxx or one of its dependencies) and tried their solutions, but to no avail.

To recap, here's what I've tried:

  • Set batch="false" numRecompilesBeforeAppRestart="50" in the web.config

  • Restarted the IIS website that hosts this website

  • Cleared the ASP.NET temporary files in %windir%\Framework64\v4.0.30319\Temporary ASP.NET Files

  • Reployed

... and any combination of the above, but to no avail. It works perfectly fine when I attempt to run the site from VS and when I deploy the website without pre-compilation.

Here are some specs of the enviroment:

  • Pre-compilation is done through a Web Deployment Project. It does not matter if TFS or I did the precompilation: the problem persists

  • .NET version is 4.0.30319

  • AppPool settings: Pipeline mode is Integrated on .NET 4.0

This is the specific error, which occurs when I open Customer.aspx:

Could not load file or assembly 'App_Web_qxcfa0wv, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

This page has registered a control called UserManagement.ascx, located at ~/Controls/UserManagement.ascx.

That control has registered another control called UserDialog.ascx, which is located at ~/Controls/Dialogs/UserControl.ascx.

And that last control uses a control called ~/Controls/User.ascx which encapsulates the data of a user. There are no further dependencies.

According to the stack trace, the error is on line 1 of UserDialog.ascx (The <%@ Control ... %> directive).

I'm at a loss. My guess is that it doesn't work because ~/Controls/Dialogs/UserDialog.ascx requires a control which is in a parent folder, which results in some out of date reference during runtime. Kind of like the problem description in the first SO question.

However, I can't test that simply by excluding the ~/Controls/User.ascx control because then I'm getting circular reference errors in another control which is used in ~/Control/UserDialog.ascx, even though that control doesn't register any other controls, either. Only a namespace registration, which is used by most other controls.

I'd say that the circular reference and the error are related, though, but I can't quite say how. Not without drawing an entire dependency graph.

Any ideas?

Thanks in advance!

3
  • Does the ~/Controls/ and/or ~/Controls/Dialogs/ directory exist on the server?
    – robertc
    Apr 12, 2012 at 17:18
  • @robertc: Hm, I didn't check that. Apparently, the ~/Controls/ folder exists, but the ~/Controls/Dialogs/ folder doesn't. Strange, because the ~/Controls/Lists/ folder does exist, but it seems that the only reason that it was built is because it contains an ASPX page. In VS2010, the ~/Controls/Dialogs/ folder only contains ASCX files, which might explain why it's not there in the build...
    – user849924
    Apr 13, 2012 at 15:35
  • See my similar question - I ended up creating an empty placeholder.html file in each directory which only contained ascx files so that the directories would be created on the server.
    – robertc
    Apr 13, 2012 at 15:39

1 Answer 1

1

Convert it to a Web Project, seriously. This is a known problem when using libraries and user controls with the website template. I've summed it up here:

ASP.NET: Web Site versus Web Application Project

More information on Rick Strahl's blog (read the comments):

Understanding Page Inheritance in ASP.NET 2.0

3
  • 1
    Thanks! I'll let you know how it turns out. The reason we generally don't use Web Application projects is because of the Edit and Continue that the Web Site model has, but other than that, there are no real reasons why we don't use them. I have some controls in Old_App_Code which can't be found anymore, but I wanted to move those out of there, anyway.
    – user849924
    Apr 13, 2012 at 15:32
  • It's the best way to go; benefits of website template are outweighed by all the probs. Apr 13, 2012 at 15:38
  • 1
    Hrm, apparently the designer files getting corrupt or not updating properly. I did a site-wide search and replace of controls, right-clicked the Web App and did "Convert to Web Application" and nothing really seemed to happen to my designer files. Only when I touched the page/control in question did it regenerate properly. I've got it to work now, but not as a Web App yet.
    – user849924
    Apr 16, 2012 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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