Interop service error occured when using InternetExplorerClass - c#

i am trying to deploy an asp.net web service application to IIS 7.5. The application used .Net framework 3.5. dev machine is win 7 64bit. i have used following code snippet to create HTML and then convert it to pdf using Amyuni Document Converter 450.
private InternetExplorer internetExplorer = new InternetExplorerClass();
when i deploy the application in local development server it perfectly run but whn i deploy it using the local iis server it gives following error. any reasons for that.. i have used impersonate='true'
System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {0002DF01-0000-0000-C000-000000000046} failed due to the following error: 80080005.

You have to change property in DComConfig for ie.
Follow the next steps:
Start->Run->dcomcnfg->Component services>Computers>My Computer
Right click on My Computer and select Properties. On the Security COM tab set the Default Autethentication level and Default Impersonation level.

Related

IronPDF Renderer.RenderHtmlAsPdf failing when deployed to IIS

We are using ironPDF to genetate PDF file from HTML string. It is a MVC web application written in C# (.net framework 4.8) , deployed to IIS
I did the following.
Added IronPdf nuget package to the project (Version: 2022.11.10347)
Use the following code to generate PDF from string
using IronPdf; (on top of the code to add ref)
PDF generation code as below;
public ActionResult ExportPDF()
{
var Renderer = new IronPdf.ChromePdfRenderer();
var pdfDoc = Renderer.RenderHtmlAsPdf(htmlstring);
return File(pdfDoc.Stream.ToArray(), "application/pdf", "TransactionStatement.pdf");
}
here htmlstring is the html that need to be rendered to PDF
This code works fine and generates PDF when I run in my local dev machine.
But when I deploy this code to our integration environment , it is failing. It is not generating any PDF.
It just hangs for couple of minutes then our website is getting timed out and application pool is getting stopped.
the failure is happening is in the following line
var pdfDoc = Renderer.RenderHtmlAsPdf(htmlstring);
Out integration environment is in IIS (Windows server 2008 R2) . and application pool identity is NetworkService.
When I looked into the event log I can see the following warnings
Application popup: IronCefSubprocess.exe - System Error : The program can't start because api-ms-win-core-com-l1-1-0.dll is missing. from your computer. Try reinstalling the program to fix this problem.
A process serving application pool '<poolname>' suffered a fatal communication error with the Windows Process Activation Service. The process id was '5940'. The data field contains the error number.
I have all required Visual C++ redistributables installed in my server as described in the ironPDF website
Any idea how to fix this issue.
For API-MS-WIN-CORE-COM-L1-1-0.DLL. You could refer to this to reinstall API-MS-WIN-CORE-COM-L1-1-0.DLL.
About application pool error. As the community member said, need configuration information is needed to locate the cause.
In my opinion, you could try turn Enable 32-bit applications to true. If still don't work, you can refer to this using debugging tools to locate the cause.

Can't instantiate multiple VFP COM Dlls: 80004005 Unspecified error

I've got two sample VFP9 OlePublic dlls that I'm calling from a .NET Core 2.1 project running full framework .NET 4.6.1. Everything is working fine locally but upon deployment to a Windows Server 2016 machine, I'm only able to instantiate an instance of a.dll or b.dll, not both. It seems the last one to be registered wins.
If I register a.dll then b.ll, I can instantiate an instance of b & vice versa.
Retrieving the COM class factory for component with CLSID {CF0998BA-54F1-40BD-BB92-4E938A77E1E5} failed due to the following error: 80004005 Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)).
Define Class miked As Session OLEPUBLIC
FUNCTION HelloWorld as String
RETURN "Hello World"
ENDFUNC
FUNCTION Echo(thingToEcho as String) as String
RETURN thingToEcho
ENDFUNC
Enddefine
public void TestMikeDll()
{
new miked.miked();
}
I'm guessing I haven't configured/defined something correctly in my VPF9 projects? đŸ¤”
publish profile:
update
So it's not the last one registered, it's the first one to get instantiated. If I successfully instantiate a.dll then b.dll fails but if I recyle the app pool & try b.dll first it succeeds & a.dll fails.
Give the AppPool identity write (maybe modify too) access to the location of the VFP COM Dlls. Apparently, it needs to dynamically create another DLL: [original name]r1.dll that has a file desc of "Microsoft Visual FoxPro 9.0 SP2 Runtime Library" (the purple box).
Go to properties on folder where COM DLLs live
Security Tab
Edit
Add
in enter the object names to select: IIS AppPool\[your AppPool name]
reference: MSFT doc page on giving AppPool identity file permissions
credit: this comment from Aloio Kraus lead me down the path:
the 5 of the error code is the Win32 error code which means access denied. I would run procmon and watch for registry/file accesses which fail. That should hint to the right direction what went wrong

Google Speech - After Hosting getting Unauthenticated Error

I have created a web api method to Speech to text using Google Speech library. It is working fine when I execute using the visual studio. After hosting the application on IIS, I am getting below error when the api method is called
Method:Status(StatusCode=Unauthenticated, Detail="Getting metadata from plugin failed with error: Exception occurred in metadata credentials plugin.")
Error at line with code:
var speechResponse = speech.Recognize(SpeechConfig,
RecognitionAudio.FromFile(fileToProcess));*
And on another system, I have configured the GOOGLE_APPLICATION_CREDENTIALS env avariable with service account json, but I am getting below error
The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials.
Do you also have compact framework sdk installed for visual studio? if try adding
< NoStdLib > False< / NoStdLib >
in your *.csproj file. This would force VS to use the std mscorlib.dll instead of compact one.
Check if the date and time on your system are correct (should be with 60 seconds of actual time)

Code runs on development server but not on IIS

I have a web application where user run queries(through web interface) and gets output in excel format. Sometimes this output comprises of more than 300k records. The user needs this data for further research.
Now in order to speed up the dynamic excel creation with such large volume of data, we are using "Microsoft.Office.Interop.Excel" COM object.
Our code works completely fine on the in-built asp.net development server. However, when hosted on the IIS, it gives us "Access is Denied" error (exact error is as shown below).
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
I have given all the rights to the IIS user but still this is not working.
I have tried Windows Server 2012 R2 as well as Windows 7 OS and it doesn't work on both of them.
I have made changes to the "DCOMCNFG" and granted access to the web users under the "COM Security" tab also.
What are some additional steps I can take to make this work?
Have a look at the following links -
"Retrieving the COM class factory for component.... error: 80070005 Access is denied." (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
http://forums.iis.net/t/1205506.aspx?Retrieving+the+COM+class+factory+for+component+with+CLSID+failed+due+to+the+following+error+80070005+access+is+denied
https://waheedrous.wordpress.com/2014/01/26/error-office-interop-assemblies/
This is a COM permissions problem.
Start > Run > dcomcnfg
Navigate to Component Services > Computers > My Computer > DCOM Config
Locate the Microsoft Excel Application
Right click > Properties
On the security tab: Select Security under Launch and Activation Permissions and click Edit…
Add the account under which the site is running (eg: Network Service) and assign Local Launch & Local Activation permissions
Source
Also the ASP.NET Authentication should be enabled.
I think for this to work, office has to be installed on the server.
So if this is not the case, install Office on the server.
(alternative is to use OpenXml http://www.microsoft.com/en-us/download/details.aspx?id=30425)
I have decided to give up on using COM object for Excel operation on the server. Instead, I have decided to use EPPlus open office XML SDK for generation of Excel files. This works without any additional security permission requirement on the server.

c# OPC Automation gives 80040154

I am a .Net developer. New to OPC. When I tried some samples of OPC Client all of them give this error. It seems the DLL is not registered it seems. But I don't know how and where to register this.
error: retrieving the COM class factory for component with CLSID failed due to the following error: 80040154
Even I tried this
regsvr32 Interop.OPCAutomation.dll",
but it also throws error like
The module "Interop.OPCAutomation.dll" was loaded but the entry-point DllRegisterServeer was not found.
Make sure that "Interop.OPCAutomation.dll" is a valid DLL or OCX file and then try again.
I have gone through so many existing forums. So many of them said to change the Platform Target to x86 and still I am having the same issue. FYI, I can see only see 'Active (Any CPU)' in the Platform option from the top of the Build tab of Project Properties.
Here are my environment details:
.Net 2005
OPCAutomation Weapper
Windows 7 64-bit OS
Dell Inspiron 1525 (I hope this is not a 64bit machine, but my engineer installed 64bit OS somehow).
Please help me.
Thanks in advance!
Just in case somebody is dealing with this problem (as I've recently been...) I get through it! After some time, I found out that it's something about the .NET framework running on 64-bit machines. As long as the.NET application works only with 32-bit CLR, we must set .NET framework to load CLR in WOW mode. To do so, type:
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe SetWow
After this you should be able to run the applications.
You can go back and revert .NET Framework as it was before by typing:
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Ldr64.exe Set64
If the OPC Client Toolkit SDK (C++) is used, a problem with the remote registry service may cause this error as well.
On Windows 7, by default the Remote Registry service is set to manual and not started. Ensure that the Remote Registry service is started on all of the machines you want to deploy to. This can be done manually or using Group Policy.
The function GetCLSIDFromRemoteRegistry() uses the RemoteRegistryService in order to get the CLSID of an OPC Server. If this service is not started on the client machine, the OPC program may return the error 80040154.
The error you're getting is more than likely due to the OPC server not being properly registered. Make sure it is registered (usually by running it at the command line with a "/regserver" or "/service" parameter). There may also be security issues in which case you'd have to run 'dcomcnfg' (DCOM Config) to make sure the client has access to the server.
This question is a bit dated so I hope you figured it out by now, but I had the same exact issue and wanted to share my solution. In my case, I am using a Kepware server. If you compile and try to run a client application for this server using Interop.OPCAutomation on a machine that does not have the server installed, you will get a dll not registered error and "entry point not found" if you try to register the dll manually.
Solution: Make sure you've got the server installed and running.
Although this is an old post, I would like to share my solution.
My problem was that when I tried to install an application with the OPCAutomation.dll, it gave me 80040154 error because the class was not registered.
This is my solution, always with Administrator privileges:
Copy OPCDAAuto.dll into the "C:\Windows\System32" folder
On the cmd prompt type "C:\Windows\System32\regsvr32 opcdaauto.dll"
You should watch a message like this one:
image
Hope this helps!
The OPC dll only works in 32 Bits, my solution was to change the "Enable 32-Bit Applications" to True in the advanced settings of the relative app pool in IIS.

Categories