When you try to open a page or compile an application, the framework tries to load an older version of your application, which was cached when you run your project previously. This may cause this issue.
To solve it, do the following:
1. Close Visual Studio;
2. Clear "Temporary ASP.NET Files" directories using A tool for clearing Temporary ASP.NET files.
You can do it manually by clearing the following folders:
- C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files
- C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET Files
- C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files
- C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Files
- C:Users[your_user_name]AppDataLocalTempTemporary ASP.NET Files
Restart the "World Wide Web Publishing" service (Start menuSettingsControl PanelAdministrative toolsServices).
3. Clear the project's Bin and Obj folders and deploy new assemblies if it is necessary;
4. Rebuild your application.