My ASP.NET App_code is not getting changed (or cached ??)

Help!! I have one .cs file in the App_Code directory (root level) in order to get the correct template for the requested URL (it is linked to our own Content Management database). Initially, it worked fine - I could make changes to it, and they were picked up by the web application in order. Then something happened (I don’t know what), and now, no matter what changes I make, they are not recognized. Even if I delete the entire App_Code directory, it does not matter - I still seem to be collecting an earlier (cached) version of what was in the App_Code directory. The code in the .cs file is below:

using System; using Custom.CMS.Facade; using Custom.CMS.BO; public class CMHttpModule : IHttpModule { code here... } 

The same problem occurs even after I copied the website to our live server.

What I do not understand is that if I present a biased error in the .cs code, I still get a compilation error, and when I successfully compile in C: \ WINDOWS \ Microsoft, the App_Code.xxxx.dll application is created. NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files

So, which version of App_Code is my web app that is really picking up? How do I get him to choose the "right"?

FYI I am using C #, the web server of Visual Web Developer Express 2008 and IIS 6

Any help would be greatly appreciated.

+7
source share
6 answers

Reopening the solution also works.

+5
source

You can right-click the file, go to properties and check the action of the assembly. It must be installed in Compilation.

+3
source

I'm not quite sure how you publish your web application, but there are a few things you could try:

  • As mentioned earlier, make sure that you use project links instead of file links for DLLs that are created from your own C # projects. Also, make sure your .cs file in the App_Code directory has its Build Action installed in Compile
  • Make sure that all projects are aimed at the same .NET platform: v2.0, v3.5, v4.0 or v4.5. You can check this on the Application tab in the Properties each project. Do not use to modify the client profile.
  • In the source code, delete your built-in DLLs (usually in the bin and obj folders), and then use Visual Studio to complete the build. This is the equivalent of Rebuild (read: Clean, then Build). Then publish to your web server.
  • If you have indicated the obvious, make sure that the web browser that you use to view your site has cleared its cache before you click on the site.

Hope this helps.

EDITOR: Just suddenly thought: is this an ASP.NET web application really a website? If so, then your code changes may not be recognized by the ASP.NET compiler because "if the code file is not referenced, it will not compile."

The main difference between an ASP.NET website and an ASP.NET web application is that the former is usually compiled (automatically) by ASP.NET on the server the first time it receives a request after the site has been installed or updated, and the latter has been fully compiled in a dll before publishing it. You can learn more about this in the links above.

+3
source

I had the same problem yesterday, and I fixed it, making sure that the links to the class libraries refer to the website project, pointing to your class library projects (and not the dll in the bin folder).

It looks like the website is targeting .net 2.0, and the class libraries are in .net 3.5, as the website project ignored the restored dll and used the ones in the bin folder of the website project.

+1
source

@SeanW -

1) Have you tried changing your Web.Config, rather than deleting it directly? Web.Config is cached, but any processing should recycle your application cache.

2) Have you tried to blow off your entire site and copy it from scratch? (Especially be sure to delete and recompile any precompiled files in the bin directory.)

@Patrick -

1) Have you tried to delete everything in your directory of temporary ASP.Net files?

2) If you had versions for dependent projects in your solution (and not in your startup project), did you manually rebuild these dependent projects individually?

3) Do you have access to recycle the application pool for your website on the Internet in IIS?

4) Have you tried rebuilding your website from scratch or changing the Web.Config website on your website?

General Application Cache Tips -

  • You can frequently update your application cache by making a trivial version of your Web.Config file.

  • As discussed in this topic , Global.asax changes, bin directory changes, and App_Code changes can also trigger an application pool update.

  • As a long-term solution, you might want to manage your application cache using file dependencies or the SQLCacheDependency class . (Although this last sentence may not work on shared sites such as GoDaddy.)

+1
source

The ASP.NET web application has several pitfalls. Rebooting a project is one way to solve several problems ... Strange, really (call me a mistake)! Personally, I prefer ASP.Net websites (instead of applications) with JIT Compilation . FMO is a quick, easy, and easy way to support prj.

0
source

All Articles