Error HRESULT E_FAIL has been returned from a call

2020-01-27 01:58发布

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?

30条回答
姐就是有狂的资本
2楼-- · 2020-01-27 02:15

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

查看更多
对你真心纯属浪费
3楼-- · 2020-01-27 02:16
  1. Add on development initiated on x86 architecture or 64 bit system then it will run on 32bit system also.
  2. 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)).

查看更多
Melony?
4楼-- · 2020-01-27 02:17

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.

查看更多
在下西门庆
5楼-- · 2020-01-27 02:17

I fixed the same issue by deleting ComponentModelCache folder

  1. Close Visual Studio (if you haven’t done so already out of despair)
  2. Open a file explorer window and navigate toyour AppData folder. You can get there by:
    1. In the search bar, type %APPDATA%/.. and press enter
    2. Alternatively, navigate to C:\Users\\AppData
  3. Go into Local\Microsoft\VisualStudio\<version> where is 12.0 for Visual Studio 2013.
  4. Delete the ComponentModelCache folder.

From here: http://withmartin.net/how-visual-studios-component-model-cache-can-be-a-pain/

查看更多
戒情不戒烟
6楼-- · 2020-01-27 02:17

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:

  1. Close Visual Studio and Repair it through Control Panel.
  2. Restart system

After the restart, the error was gone.

查看更多
趁早两清
7楼-- · 2020-01-27 02:18

Sorry to revive a dead thread but i solved this on VS2017 by deleting the project template cache and item template cache folders in

%appdata*\Local\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.

查看更多
登录 后发表回答