Notorious Visual Studio Error C1902, VS configuration - visual-studio-2010

I am getting the notorious "Error C1902: Program database manager mismatch; please check your installation" in my VC++ builds in Visual Studio 2010. My VS will not even build hello world, there is no pdb file even in existence in the folder.
Steps I have tried:
cleaning and rebuilding (3 different projects including hello world, about 15 times)
removing every single instance of Visual Studio before version 2010 from the computer including all redistributables. There is no copy of mspdb*.dll on my computer anywhere except the latest version (100) in my 2010 directory.
Reinstalling 2010. I completely reinstalled VS 2010. No effect.
Rebooting my computer. I have spent the afternoon deleting anything that might be remotely related to this bug and rebooting over and over again.

I solved the problem by finding an obscure post to a similar thread created a couple of years ago on a different forum. Here is the solution:
Copy the file mspdbsrv.exe from the VisualStudio/Common7/IDE directory to the /VC/bin directory.

cyglas-config solved the problem on my build system. Is seems that Vs2010+ needs this but vs2008 didnt.

I have seen this caused by two projects sharing an intermediate directory.

Make your your VS2010 is running under administrator and have the right permission.
Our IT deployed a tool for blocking access to several "ports", it turned out all my VC project cannot build in VS2010. He then re-deployed the tool with "allow elevated program access blocked 'ports'" checked and everything is back to normal.

Verify local user account if ran under automation is not locked. this turned out to be a resolution for issue I had seen with "fatal error C1902: Program database manager mismatch; please check your installation" message.

I had the same error, and the problem was that the "mspdbcore.dll" file was deleted from my \Microsoft Visual Studio 12.0\Common7\IDE\ folder. This post helped me solving my issue.
PS:The deletion was made by a "duplicate files cleaner" utility.

Related

Why do I get an error for "__CrtGetFileInformationByHandleEx " when I try to compile

I just installed Visual Studio 2015 Community on my computer. Until now I have been using Visual Studio 2010 Professional. Now when I try to run my MVC apps in the build in web server, I get the following error message.
The procedure entry point __CrtGetFileInformationByHandleEx could not be located in \WINDOWS\SYSTEM32\msvcp120_clr0400.dll
I get the same error message if I try to execute vbc.exe (the Visual Basic compiler) on directly at the command prompt. My MVC app also shows a YSOD with
Compilation Error - Compiler Error Message: The compiler failed with error code -1073741511.
How can I fix my VS so I can run my programs again?!
Steps I've tried
Uninstall VS 2015 Community
Uninstall and reinstall .NET 4.6 and .NET 4.5.2
DISM /Online /Cleanup-Image /RestoreHealth
The .NET Repair Tool
Run sfc /scannow
Manually rename the msvcr120_clr0400.dll file to msvcr120_clr0400.dll.corrupt and do 1-5
Uninstall and reinstall VS 2010 w/ SP1
sfc /scannow successfully replaced the msvcr120_clr0400.dll file, but it replaced it with the exact same CTP file as before!
EDIT:
The problem dll's from my system are available for download here:
32 bit
64 bit
32 bit msvcr
64 bit msvcr
Microsoft is aware of this issue with KB3098779 and 3097997:
https://support.microsoft.com/en-us/kb/3118750
The recommendation is to uninstall these patches and then rescan for updates. Newer versions of these security patches (that do not break the VB compiler) are now available.
Okay, I see it from the files you uploaded to the sharing service, your .NET install is corrupted. A standard DLL Hell problem, your c:\windows\syswow64\msvcr120_clr400.dll file is the wrong version. Something you can see when you use Explorer and navigate to the file. Right-click and select Properties, look at the Details tab.
Note the word "CTP" in the Product name, means "Community Technology Preview". A Microsoft term that means "beta version". Clearly you should not be having the VS2013 beta on your machine. Your msvcp120_clr0400.dll is correct, it is file version 12.0.52512.0. It depends on an exported function in the msvcr DLL that the CTP version did not yet have.
Exactly how this happened is always hard to reverse-engineer. You are the 3rd SO user that I know of that had this problem this week, a bit too much of a coincidence. Two basic scenarios, if you ever had the VS2013 CTP edition installed on the machine then the problem is that it didn't get updated like it should have. Otherwise a very typical problem with CTP editions, they are pretty dangerous because the uninstaller is always the last thing Microsoft gets right. And the problem was just never detected until you started using a program that required this export.
Or it was caused by a rogue installer, copying the old version onto your machine without checking the version number. Much less likely, installers never have a good reason to install this particular file since it is only ever used by the .NET Framework. My money is therefore on your machine getting corrupted by the CTP.
You need to solve this by getting your machine fixed. Not that easy, you can never be sure how many other bad DLLs are lying around from such a bad CTP uninstall. A shortcut is copying this particular DLL from a good machine. But best to get .NET 4.6 re-installed.
EDIT from OP:
This answer correctly identified the problem files but reinstalling (or any other common steps) didn't solve it. In the end I copied "good" files from another computer with the version number 12.0.20806.33440.
KB3098779 appears to be the culprit on our server. That is the patch that installed the rogue CTP msvcr120_clr0400.dll mentioned in the above answer.
Solution: we reversed out the patch set that applied KB3098779, and everything is working again.
FYI: this is a .NET framework 4+ issue, not Visual Studio. Our server is a standard 2012 IIS server: Visual Studio is not installed.
I had the same issue on Windows 8.1 although KB3098779 and 3097997 were not installed on my machine. Probably it happened after installation of ASP.Net 5.
The issue was that I had both mcvcr files in version 12.0.51670.34230 while mcvcp files were already in 12.00.52512.0. It was enough to copy both mcvcr files (from System32 and SysWOW64) in this version from my colleague's pc.
If you have problems with permissions set to TrustedInstaller on these file, you can run this powershell command and then change permissions as Administrator:
takeown /A /F C:\windows\syswow64\msvcr120_clr0400.dll
Microsoft have issued a notice on this.
https://support.microsoft.com/en-us/kb/3118750
As others have pointed out too many people in too short a time to be a coincidence. Not a VS issue, this is to do with a bad update from Microsoft.
The info from MS mentions two security patches (KB3098779 and KB3097997).
I have uninstalled only KB3098779 and my site is up was up and running. It required a machine restart to complete
KB3097997 uninstalled without a restart. I maybe didn't need to uninstall but seems sensible given it is also subject to the same notice from MS.

Visual Studio 2010 - Cannot Register Assembly

I am running Visual Studio 2010 on a Windows 7 VM and trying to build a fairly large solution. When I try to do so, I get the error:
Cannot register assembly "C:\Development\ProjectName\Source\bin\Debug\AssemblyName.dll" - access denied. Please make sure you're running the application as administrator. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
I have taken the following steps:
Confirmed that I am in fact running Visual Studio 2010 as administrator.
Restarted the VM.
Confirmed that the assembly does exist exactly where Visual Studio is looking for it.
Confirmed that administrator has full control over the relevant file.
Cleaned and rebuilt the project (multiple times).
I have also found that building the project which creates AssemblyName.dll, manually registering it with RegAsm, and then building the project which requires AssemblyName.dll does not result in an error, but this is not a desirable workaround as it requires manual control. Can anyone give me some advice on how to solve this problem?
Many thanks.
This particular issue happens when you are building an assembly project which has the 'Register for COM interop' checked under the Compile tab of the project properties. As Stephane said, you must right click -> Run as Administrator in order for it to register automatically.
If you already have the compiled assembly from a different machine, you can alternatively register it manually and reference the compiled assembly with the project to by-pass the issue.
When you ran VS2010, did you right-click and select "Run as administrator"? If not, it actually runs as a lower priviledged user. Once I selected "Run as administrator", this problem went away.
I also ran into this error even though I was running VS 2015 as administrator.
In my case I found that manually cleaning up (ie deleting) bin\Debug\*.* for the project resolved the issue. Apparently some kind of file permissions or something was preventing the operation, and the error message may have been incorrect.
I'm not sure what was causing the file 'conflict' in the first place.
Similar to what UuDdLrLrSs said, when I tried to clear the bin folder, Windows gave an error on file access. Apparently another process was using the file - in my case, Microsoft Access.
After closing the associated program that had a file handle, the project built fine. (Although I'm still a little confused as to why it had a file handle on debug assemblies...)

Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging

I have a problem debugging a project migrated from Visual Studio 2010 to 2012. Every time I go to debug it I get the error message:
"Error HRESULT E_FAIL has been returned from a call to a COM component".
Compiling and running the application in a local IIS server works fine - just cannot debug.
The other change other than moving to VS2012 is I am now using Team Foundation Server for source control and issue tracking - but I cannot see how that would affect it.
I can narrow it down to the following
The project file - it has been migrated from VS 2003 as a website project and has been chopped and changed up the different versions
Crystal Report runtime library/ some other library
Anyone with any ideas?
I had the same problem with a c++ project in Visual Studio 2019.
The following solution worked for me:
Close Visual Studio.
Go to the project's root folder and delete the .vs directory.
Start Visual Studio and open the solution.
The build should now work.
I have been getting this a lot lately. I've been having to create a new file and move the code to the new file to get around it.
I fixed it by deleting the solution's suo file (as far as I can tell, it just stores info like what files are open in the IDE and stuff, and deleting it does no real damage).
My file was seemingly corrupt. (The IDE wouldn't remember what files were open when restarting. It was 1.7MB in size, which seems large, even for my 40 project solution, which rarely has more than 50 files open at once.)
Edit: I just recently had to do this in VS2017 but for another reason, it was taking longer to build and took 5+ minutes to stop a debug session, deleting that pesky suo file fixed it right up, now anytime VS acts weird deleting SUO is my first port of call.
I removed the csproj.user files and it worked for me.
In some other cases, to fix this error, I go to Web tab in the project properties and check "Use Visual Studio Development Server" and "Auto-assign Port". After that I need to rebuild the project and restart VS
This solved my problem:
Start —> Run —> regsvr32 %SystemRoot%\System32\msxml3.dll
Start —> Run —> regsvr32 %SystemRoot%\SysWOW64\msxml3.dll
Before this I tried the above solution from Simon, but didn't work for me!
Perhaps combining these two solutions did the job!
Sorry to revive a dead thread but i solved this on VS2017 by deleting the project template cache and item template cache folders in
%localappdata%\Microsoft\VisualStudio\[BUILD]
Then resetting the visual studio settings via
Tools>Import and export settings>reset all settings
Also ive heard turning off "Lightweight solution load for all projects" can help.
Doh! In case anyone else gets this error when trying to attach to an IIS Website.
Triple check that your hostname is correct, I had forgotten a '/' in (e.g.) http://my.testsite.com
Try this before re-installing Visual Studio like I did.. Terrible error message..
I wanted to add that I encountered this error when opening designer file in WinForms app. My issue was that one of the references in the project was referencing itself. Apparently this can happen as mentioned here
https://social.msdn.microsoft.com/Forums/office/en-US/00aede04-d8cd-4475-8114-4b4792261052/winforms-designer-error-hresult-efail-has-been-returned-from-a-call-to-a-com-component
I removed the reference and it is working fine.
Maybe this page helps:
Scenario Two:
The Microsoft Visual Studio 2010 IDE crashes while creating OR debugging a web application project.
This above error occurs because of corrupted Cache of Visual Studio 2010. In order to resolve the issue just delete the project Cache from the below location:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
C:\Program Files(x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache
Then run devenv.exe /setup to re-build the cache.
I tried all of the above solutions none work for me, I found the solution here
Open ActivityLog.xml by going into
C:\Users\{UserName}\AppData\Roaming\Microsoft\VisualStudio\15.{Id}
Check if error states that
"CreateInstance failed for package
[ReferenceManagerPackage]Source: 'mscorlib' Description: Could not load type
'Microsoft.VisualStudio.Shell.Interop.' from assembly
'Microsoft.VisualStudio.Shell.Interop.11.0'
Then run this gacutil command through VS Cmd prompt (admin mode):
Navigate to
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies
Run gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
It seems that to bring up the Add Reference dialog in Visual Studio 2017 the Microsoft.VisualStudio.Shell.Interop.11.0.dll needs to be regsitered in the GAC. You can follow these steps to register this assembly in the GAC:
Open the Develop Command Prompt for VS2017 (ensure you run the as administrator otherwise the GAC registration may fail)
Change the current directory to the PublicAssemblies folder for your Visual Studio 2017 installation. Mine was:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies
Run the following command to register the assembly in the GAC:
gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PublicAssemblies>gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly successfully added to the cache
Now restart VS2017 and try to add a reference to your project again and you should see the Add Reference dialog appear.
For more clarification please follow below link
https://camerondwyer.com/2017/05/03/how-to-fix-the-operation-could-not-be-completed-error-adding-reference-to-visual-studio-2017/#more-2286
I found the solution below on https://developercommunity.visualstudio.com/content/problem/260196/add-a-reference-raise-error-error-hresult-e-fail-h.html address.
It worked for me in VS 2019:
1 Open "Developer Command Prompt for VS 2017" as Admin
2 CD into "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
3 Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"
After a restart, it all worked well.
I had the same issue after an upgrade from VS2013 to VS2015.
The project I was working at referenced itself. While VS2013 didn't care, VS2015 didn't like that and I got that error. After deleting the reference, the error was gone. It took me around 4 hours to find that out...
Just delete packages folder.That helped me
Root Cause:
Microsoft.VisualStudio.Shell.Interop.11.0.dll is missing from GAC.
Solution:
1. Go to start menu and Open Command Prompt for Visual Studio
2. Enter command gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
3. If in case your system unable to find this dll file then you may download it from Nuget package manager and then can provide the path of dll
All set! hit enter and you're done!
In my case, it seems it was because I stashed some files, but some related windows remained open.
Closing all windows and rebuilding solution fixed it for me.
I wrote a simple program to open different folder while clicking on some specific buttons. I made the file properties as "content" and "copy if newer" to make deployment. So if I installed the exe file in the other software it actually install all of its resources and run the program fine.
So, this is all about my program. While developing this sometimes if I run the program to check, it showed the error
"HRESULT E_FAIL has been returned from a call to a COM component"
and I could not open the designer view. But Somehow I got an easy solution for me. I am not sure whether it will work for other or not.
Here is the solution:
Copy the whole application folder to another location. click on the application file from there.
it will not work since it is just a copy and you will not see the designer
From the solution explorer delete the form1.vb ( or may be a different name if it was changed during developing)
In the solution explorer>right click>add an existing item> browse the file Form1.vb from where the folder is copied ( orginal location)
run the program in the new location. It will work
The problem with this solution if you want to add something and after running the program you find the same error, you have to copy the whole application folder in another location again and follow the above steps
Not sure about the exact reproduction steps for the error (HRESULT E_FAIL has been returned from a call to a COM component), but the solution for me was:
Close Visual Studio and Repair it through Control Panel.
Restart system
After the restart, the error was gone.
The error occurred for me after I installed the latest Windows 10 SDK. I was getting the error while building a C++ project using SDK 8.1. In Project properties, I switch to latest 10 SDK. rebuild. That worked. Changed back to 8.1. Rebuild. No error.
Steps to resolve the issue:
1.Open your solution/Web Application in VS 2012 in administrator mode.
2.Go to IIS and Note down the settings for your application (e.g.Virtual directory name, Physical Path, Authentication setting and App pool used).
3.Remove (right click and select Remove) your application from Default Web Site. Refresh IIS.
4.Go back to VS 2012 and open settings (right click and select properties) for your web application.
5.Select Web.In Servers section make sure you have selected "Use Local IIS Web Server".
6.In Project Url textbox enter your application path (http://localhost/Application Path). Click on Create Virtual Directory.
7.Go to IIS and apply settings noted in step 2. Refresh IIS.
8.Go to VS 2012 and set this project as startup Project with appropriate page as startup page.
9.Click run button to start project in debug mode.
This resolved issue for me for web application which was migrated from VS 2010 to 2012.Hope this helps anyone looking for specific issue.
My machine configuration is:
IIS 7.5.7600.16385
VS 2012 Professional
Windows 7 Enterprise (Version 6.1 - Build 7601:Service Pack 1)
This happens in our TFS build server some times (Gated check in). It is about workspace folder. I don't know why but workspace folder access sometimes corrupt. What I am doing to fix issue is deleting TFS build workspaces and deleting relevant workspace folders. TFS build machine then create new workspaces for itself and problem is fixed.
Tousif Ahmed's solution should work for local builds. Copy application folder to another place should do the same thing what I am doing in TFS build machine.
In my case, it appears that this message can be issued by Intellisense in Visual Studio 2013. The screenshot below shows the error at the bottom of VisualStudio 2013 after the first load of a customer project.
I started googling what causes this error, and decided to try deleteing the user.vxproj files as mentioned above. I found however that the project built with no issues, then after exiting and re-loading the project, I no longer received the error. So I'm assuming in my case, it was some corruption due to moving the project from the customers directory tree structure to my local development disk tree structure. The key here is that in my case, the problem was transient. I did NOTHING and the problem appeared to resolve itself. (Not generally a desirable thing as I didn't fix anything so it might come back).
I recently spent about 3 hours trying to fix this issue on my ASP.NET app running on local IIS. I had 'Override application root URL' specified and I specified the url with an ending forward slash (/) such as http://my.dev.com/. If I saved the project options and came back in it would show the overrided root url as http://http://my.dev.com. Once I removed the last forward slash it started to behave ok and the error went away.
HRESULT E_FAIL has been returned from a call to a COM component
In my case, it was because i had differents projects with same GUID in my solution. (Project was created by copy/paste)
My problem manifested with opening Win10 appxmanifest file (no pun intended). Simply installing Windows 10 tools and SDK (go to New->Project->Select Windows->Install Tools) fixed it.
Add on development initiated on x86 architecture or 64 bit system then it will run on 32bit system also.
but if you Add on development initiated on 32 bit system and then you want to do changes on source code in 64 bit
Note: if you are connected SAP Licence on server system then set the port and set server name through service manager otherwise System will give error:
Connection Context :- Retrieving the COM class factory for component
with CLSID {632F4591-AA62-4219-8FB6-22BCF5F60090} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
I fixed the same issue by deleting ComponentModelCache folder
Close Visual Studio (if you haven’t done so already out of despair)
Open a file explorer window and navigate toyour AppData folder. You can get there by:
In the search bar, type %APPDATA%/.. and press enter
Alternatively, navigate to C:\Users\\AppData
Go into Local\Microsoft\VisualStudio\<version> where is 12.0 for Visual Studio 2013.
Delete the ComponentModelCache folder.
From here: http://withmartin.net/how-visual-studios-component-model-cache-can-be-a-pain/
I faced the same issue in Visual Studio 2017,
Do follow these steps:
Start —> Run —> regsvr32 %SystemRoot%\System32\msxml3.dll
Start —> Run —> regsvr32 %SystemRoot%\SysWOW64\msxml3.dll
Clean the Project.
Restart visual studio.
Step 1 and 2 were copied from Besnik Kastrati post.
I find this answer
click Ctrl+Alt+J
click (...) in the top
now you can add dll from Browse , .Net or another
After clicking the OK button click at (add to references in selected Project in solution explorer) (this is a green plus "+" button)
I got this error when trying to install a nuget package that I had previously downloaded and installed in another project.
Clicking Clear all NuGet Cache(s) under Tools > Options > NuGet Package Manager solved this for me
I encountered this error after installing VS2019 but while trying to open a large solution (20+ projects), with both vcxproj and csproj projects, that target VS2015. The csproj all loaded fine, while the vcxproj all failed with the OP's error. Deleting the .vs folder did not work.
What did work was setting VC++'s "Fallback Location", under the "Browsing Database Fallback" settings.
Tools (menu)
-Options...
--Text Editor
---C/C++
---Advanced
----Browsing Database Fallback
-----Fallback Location
I set mine to D:\VC++\v16. Where I use v140 for VS2015 and v141 for VS2017. Also set "Always Use" and "Do not warn".

Encountered an error hydrating the EDMX file?

I just got the Visual Studio 2012 RC Ultimate and I'm trying to connect to a database using EntityFramework Database First. I've created the EDMX file like I've done a thousand times and when I build my project I get 2 errors. I'm not sure if they are related or not.
Encountered an error hydrating the EDMX file 'Model.edmx'.
Could not load file or assembly 'Microsoft.Data.Tools.Schema.Sql, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I've spent several hours on Google trying to see if anyone else has had this issue and I'm not finding anything at all.
Any help would be great. Thanks
close all instances of Visual Studio
delete the file C:\Program Files
(x86)\MSBuild\4.0\Microsoft.Common.targets\ImportAfterMicrosoft.Data.Tools.Integration.targets
restart Visual Studio & rebuild solution
i hope this saves someone a lot of trouble like it could have for me -ck
update:
apparently this is only an issue if you installed VS2012RC over the top of VS2012 Developer Preview, as something was removed / renamed and that file remains from the old install and wreaks havoc...
Big thanks to divega about pointing me in the right direction with his answer on this post
EntityHydrate task failed
Look for his answer there, just simply remove this file and everything works perfectly
C:\Program Files (x86)\MSbuild\4.0\Microsoft.Common.Targets\ImportAfter\Microsoft.Data.Tools.Integration.targets
FIY
Renaming the file does not work.
Deleting it solved my problem.
One more thing: The problem occured on my 32bit W7 box only. On my 64bit W7 box everything works fine
Big thanks for the quick answer, I can continue working again.
We are trying to identify an exact repro for this issue in case this helps us getting a fix in the setup of Visual Studio 2012 RTM. I need information about the exact configurations and sequence of installation of preview and beta software previous to RC from someone that was able to repro this.

Cannot compile solution in VS due "Attempted to access an unloaded AppDomain" -- how to pin it down?

I have a C#/ASP.Net solution in VS (2008) with several projects within it. When I try to compile it I get one error only:
Attempted to access an unloaded AppDomain
No line code, no project name, nothing. Just such error.
How can I pin down this error -- i.e. the cause, or even better -- how can I solve it and continue compilation?
Thank you in advance.
Shut down Visual Studio and reopen it. Then clean the Temp folder.
For that press Windows+R and type %Temp% and click Ok, then delete everything.
If this error comes with VS follow these steps
Just restart your VS.
Start VS again
Clean the solution (Build> Clean Solution)
Rebuild your project again
If this error comes with IIS
Restart (recycle) the IIS Application Pools in IIS Manager, After restarting check run the solution again!
There are many possibilities:
Try resetting your Visual Studio's
Setting.
Or check all dlls which are
referenced.
Check all the namespaces which are
being used in your application, Do
they exist?
I am experiencing the same in Visual Studio 2012 - but ONLY on websites hosted on UNC share. My solution (when it occur) is to unload the web project and reload it again. Then in works for some time again.
The problem as I recall it is, that the hosted UNC share (or the workstation trying to access it) is running an x86 version of Windows, which does not allow to many open network connections.
In my experience these sort of problems disappear on true x64 environments.
Cheers.
it means, there is something in WebConfig/AppConfig not compatible and cannot load.
For ex.
İf you published project, check app_data/publish profiles, delete them.
Check your .sln file first if it is conflicted then delete it and update your svn folder and rebuild your solution.
Rebuild your solution
It's also possible that your unit test started up a thread but didn't close it. Ensure your threads are all closed before completion.
It might be a good idea to verify all your unit tests are running and passing correctly.
Exit the local webserver(IIS express) from the system tray and delete asp.net temp files from temporary folder & then try clean,rebuild and run your application
Following are the steps i followed to get rid of such error-
Press Windows+R , write %Temp% and hit enter. Now,delete all the temporary files from the directory.
Restart your visual studio.
Clean your project solution from Solution explorer in Visual studio List item.
Rebuild the project & Run .
It should work expected.

Resources