Retrieving the COM class factory for component failed - excel

I am using an excel object (COM component) for excel manipulation. It works fine on my PC, but when I deploy the application to our Intranet I am getting this error:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005
I am using windows authentication and impersonate=true in my web.config.
I made all the settings in component service but it still gives the same error.
Please help

I had the same error when I deployed my app. I've got solution from this site: Component with CLSID XXX failed due to the following error: 80070005 Access is denied
Here is this solution:
In DCOMCNFG, right click on the My Computer and select properties.
Choose the COM Securities tab.
In Access Permissions, click Edit Defaults and add Network Service to it and give it Allow local access permission. Do the same for < Machine_name >\Users.
In Launch and Activation Permissions, click Edit Defaults and add Network Service to it and give it Local launch and Local Activation permission. Do the same for < Machine_name >\Users.
*I used forms authentication.

This did the trick for me:
(solution from the msdn forum)
goto Controlpanel --> Administrative tools-->Component Services -->computers --> myComputer -->DCOM Config --> Microsoft Excel Application.
right click to get properties dialog. Goto Security tab and customize permissions accordingly.
In Launch and Application Permissions, select Customize, Edit. Add the user / group that calls the application.

There's one more issue you might need to address if you are using the Windows 2008 Server with IIS7. The server might report the following error:
Microsoft Office Excel cannot access the file 'c:\temp\test.xls'. There are several possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook.
The solution is posted here (look for the text posted by user Ogawa): http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required

You will also get this error when there are stale EXCEL.EXE processes in the system (Use Task Manager --> Processes tab to view these.)
Kill all those instances and the application would work normally.

I have Done the Following Things in IIS 8.5 (Windows Server 2012 R2)Server and its Worked in My Case Without Restart:
Selecting The Application Pool That Connected to The Application in IIS
And Right Click --> Advanced Settings --> Process Model --> Select Local System Instead of Recommended ApplicationPoolIdentity
And Make Sure C:\Windows\SysWOW64\config\systemprofile\desktop Have Enough Access For Users.
Refresh the Website Link that Connected With this Pool

In case it helps somebody:
I am running Windows 7 64-bit and I wanted to register a 32-bit dll.
First I tried: regsvr32 <path\name.dll> and got the following error:
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {A1D59B81-C868-4F66-B58F-AC94A4A7982E} failed due to the following error: 80040154.
Then I tried to add the application through the Component Services (Run->DCCOMCNFG) and got the following error:
System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {A1D59B81-C868-4F66-B58F-AC94A4A7982E} failed due to the following error: 80070005.
There are many links to solving it but what worked for me was:
Console Root -> Component Services -> Computers -> My Computer -> COM+ Applications -> your_application_name -> Properties: Security tab: Authorization: Uncheck 'Enforce access checks for this application'.
I don't know what it does.

I can understand your pain. In my case the error got resolved by performing below steps:
Start > Run > dcomcnfg.
Open the folder DCOM Config and Select Component Services > Computers > My Computer > DCOM Config.
Select “Microsoft Office Word 97 – 2003 document”/”Microsoft Excel Application” and go to its properties.
In "Security" tab set “Launch and Activation Permissions” need to be Customize (Authorized user).
Now go to IIS and select application pool of the Web and go to its Advanced Settings and select “NETWORK SERVICE” as identity user.
Hope this helps.

The CLSID you describe is for the Microsoft.Office.Interop.Excel.ApplicationClass. This class basically launches excel.exe through InprocServer32. If you don't have it installed then it will return the error message you received above.

For IIS 8 I did basically the same thing as Monic. Im running my application as its own app pool on an x64 machine 1.In DCOMCNFG, right click on the My Computer and select properties.
2.Choose the COM Securities tab.
3.In Access Permissions, click Edit Defaults and add iis apppool\myapp to it and give it Allow local access permission. Do the same for iis apppool\myapp
4.In launch and Activation Permissions, click Edit Defaults and add iis apppool\myapp to it and give it Local launch and Local Activation permission. Do the same for iis apppool\myapp.
additionally I had to make the folders outlined under C:\Windows\SysWOW64\config\systemprofile\Desktop and give read \ write permissions to iis apppool\myapp also

I'm getting this same error when trying to export a csv file from Act! to Excel. One workaround I found was to run Act! as an administrator.
That tells me this is probably some sort of permission issue but none of the previous answers here solved the problem. I tried running DCOMCNFG and changing the permissions on the whole computer, and I also tried to just change permissions on the Excel component but it's not listed in DCOMCNFG on my Windows 10 Pro PC.
Maybe this workaround will help someone until a better solution is found.

If you run the app from the Task Scheduler, it helps to check option in General parameters "Run with highest privileges".

Related

Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine

I am unable to load a csproj in VS2015. I get the Creation of the virtual directory http://localhost:<Port_Number>/ failed with the error: Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine. error. I tried the following:
Uninstalled and reinstalled IIS
Gave access to %systemroot%\system32\inetsrv\config & %systemroot%\system32\inetsrv\config\Export folders
Changed <UseIIS>True</UseIIS> to <UseIIS>False</UseIIS>
Rebooted the system
None of the above worked. Could you advise how to fix this problem please?
You can solve this problem in two ways:
Launch Visual Studio with Administrator priviledges.
Permanently grant the IIS Metabase folder permissions to the current user.
You can press Win + E to open a Windows Explorer instance, then write the following line on the topmost address bar depending on the OS you’re using, As soon as you hit the Enter key the following popup will appear, asking you if you want to permanently grant access to that folder to the current user, click on the Continue button, then try to open up the \Export\ subfolder with a couple mouse clicks and repeat the same process. You’re done: from now on, you’ll be able to launch Visual Studio with default priviledges and your IIS instance will work without hassles.
More information about setting you can refer to this link: setting
I had this problem when trying to load a visual studio 2015 solution. The solution would load but website project would remain unloaded and the output window would show that error message.
Click the unloaded website project in the solution explorer
Go to the properties section dock-window, there is a property called "File Path"
If it is set to an URL, change it to the full physical path to the website.
Reload the project.

How do I get my application to run with administrator rights automatically?

I've made a console application that is supposed to update some registry entries so that I can access 32 bit COM components from a 64 bit application. If I have admin rights, it works great, but I can't seem to get the application run with admin rights out of the box.
This is what I've done.
Create a Windows Console Application.
Add my code.
Right click on my project and select Properties.
Navigate to Configuration Properties > Linker > Manifest File > UAC Execution Level and set to requireAdministrator (/level='requireAdministrator').
It took a lot to figure out this because all of the info on the web is for Visual Studio 2010 or earlier which required manually creating an XML manifest file and conflicts with the auto generated one that this creates.
However, this doesn't seem to be enough to get it to run as an admin. It is a real PITA that this information isn't made easily findable. Is there some other step that I am missing? Something like a signing process?
Turns out it is how this mini application is run.
From my main programme, using ShellExecute() or ShellExecuteEx() with the "runas" verb will allow running of this executable with administrator privileges without popping up a UAC dialog.
Running this from the command line however, will result in this mini app being executed in the user's security context, which is what I was doing.

503 error, caused by `iis_ssi.dll failed to load` in the Event Viewer (eventlog)

I'm getting this error in the event log (EventViewer):
The Module DLL C:\Windows\System32\inetsrv\iis_ssi.dll failed to load. The data is the error.
OS is Windows2012 Server. How to fix it?
You need to add SSI in Server Manger. Follow these steps:
Add Roles and Features
In Server Roles, expand Web Server (IIS)
Expand Application Development
Select Server Side Includes
For Windows 2012r2 Operating systems, to be more precise following this step:
Open Server Manager Dashboard
Click on Add Roles and Features
Expand Web Server IIS (if not already selected)
Expand Web Server
Expand Application Development and ensure that all unchecked boxes are selected.
Click Next on the select feature windows to advance
In the Confirm installation selection select specify an alternate source path for the installation CD such as F:\sources\sxs to complete the installation.

web User control not added in Web part

Please help me find out why I'm getting this error.
I am not able to add web user control inside the web part. If I right click on the web part project it does not show up the web user control template.
I then copy some other web user control inside my web part project and made necessary changes to he web user control . Then I build the project but got below error. Please suggest as soon as possible.
Thanks in advance
2014/03/03 07:48:05 Error
Microsoft.SharePoint.Tools.Utilities.VSeWSSServiceException
Microsoft.SharePoint.Tools.Utilities.VSeWSSServiceException: VSeWSS Service Error: Error loading assembly c:\aon\build\Aon.Wip.Trust.UI.LTCOffer.dll.
VSeWSS Service Logging Error: Access to the path 'Microsoft\VSeWSS 1.3' is denied.
Logging failed attempting to write to Microsoft\VSeWSS 1.3\VSeWSS1.3 service.log. This may occur because the VSeWSS WCF Service does not have local administrator permissions. Please review the release notes.
at Microsoft.SharePoint.Tools.Utilities.SPProxy.HandleResponse(Response response)
at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblyFeatureElementDirector.Constract()
at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblyFeatureDirector.GetFeatureElement(ICollection`1 directors)
at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblyFeatureDirector.Constract()
at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblySolutionDirector.ConstractElements()
at Microsoft.SharePoint.Tools.SharePointSolutions.AssemblySolutionDirector.Constract()
at Microsoft.SharePoint.Tools.SharePointSolutions.SolutionCreator.CreateCore(ISPProject project, IDirectorCreator creator)
at Microsoft.SharePoint.Tools.SharePointSolutions.SolutionCreator.Create(ISPProject project)
at Microsoft.SharePoint.Tools.Forms.SPToolWindow.CreateSolutions()

Excel cannot access the file with IIS7&Windows Server 2008 R2 (64bit)

I have a web project (.NET 4) that needs to access an Excel file, but it ends up with the following error message:
Error occurred during file generation.Microsoft Excel cannot access the file 'D:\xx\xx\abc.xls'.
There are several possible reasons:
• The file name or path does not exist. (Actually it is there)
• The file is being used by another program. (It can not happen)
• The workbook you are trying to save has the same name as a currently open workbook.
In IIS7, I use DefaultAppPool with the identity "myservice" who is under the group of Administrators.
In the authentication page of my website under IIS, anonymous authentication was enabled and set to "Application pool identity" and ASP.NET impersonation was disabled.
After searching the solution for hours, I found the following but none of them work
Create folder in C:\Windows\SysWOW64\config\systemprofile\Desktop. Please refer:this
Grant rights of "myservice" in Component Services. Please refer:this
One thing strange, there is nothing in the Group of IIS_IUSRS. Is that normal? I remember at least two users (DefaultAppPool & Classic .NET AppPool).
I assume that is a permission problem of IIS, but I can not solve it.
Problem solved!!!!!!!!!! My Excel is 2010 , should create "Desktop" folder in C:\Windows\System32\config\systemprofile

Resources