Cannot recycle app pool remotely from IIS - c#

As I have seen recommended, I am using the Microsoft.web.administration library, specifically the ServerManager.OpenRemote() and manager.ApplicationPools[poolName] code to try and recycle a remote application pool. My code is
var managerTwo = ServerManager.OpenRemote(serverTwo);
var testPoolTwo = managerTwo.ApplicationPools[testPoolName];
However I get the error
{"Retrieving the COM class factory for remote component with CLSID
{2B72133B-3F5B-4602-8952-803546CE3344} from machine wycvwwebd017
failed due to the following error: 80040154 wycvwwebd017."}
It seems this error means that it cannot find the class to load. I have checked in the registry on the remote machine and the clsid definitely exists. Any idea how to troubleshoot why COM cannot find the clsid?

Related

Could not read key from registry (Exception from HRESULT: 0x80040150 (REGDB_E_READREGDB)) at Interop.QBFC13.IQBSessionManager

During a deployment of an update to our Web Service that QuickBooks Web Connector calls, we are not having a bunch of issues related to the Interop.QBFC13.IQBSessionManager. Note our code all works in development environment and has worked in the past on our production server.
We are running on a 64 bit Windows 2016 server, but are running the IIS site for our web service as 32bit and did compile the project as x86 and verified the dlls are x86.
We started with this error, then added the App Pool Identity permission to the registry keys associated with this class Id/
Error message: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidCastException: Unable to cast COM object of type 'Interop.QBFC13.QBSessionManagerClass' to interface type 'Interop.QBFC13.IQBSessionManager'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{50F59D7F-4E65-45D8-8F19-135F9FE05296}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
After that, the error message changes from No such interface supported... to Library Not Registered.
Now its giving
System.Runtime.InteropServices.COMException: Could not read key from registry (Exception from HRESULT: 0x80040150 (REGDB_E_READREGDB))
at Interop.QBFC13.IQBSessionManager.CreateMsgSetRequest
But it doesn't state which registry key it is trying to read.
It is always at the same place in our code where the error is triggered:
IMsgSetRequest msgSetRq = sessMgr.CreateMsgSetRequest(qbXMLCountry, (Int16)qbXMLMajorVers, (Int16)qbXMLMinorVers);
We've tried uninstalling, re-installing the QB SDK, QBFC13_0Installer.exe and QBXMLRP2Installer.exe...all with reboots after uninstalling and reinstalling.
Not really the answer to the actual problem, but you can usually figure out permission (and other) issues with registry by using Process Monitor.
The actual problem seemed to have been that IIS APPPool did not have proper rights for the registry key.

Unable to find Powerpoint COM Object with CLSID {91493441-5A91-11CF-8700-00AA0060263B} to set permissions

My web application is manipulating Powerpoint files. When I run it with my admin credentials it works, however when it is run by the Application Pool, it fails with error 80070005 Access is denied.
Been there, done that: all I need to do is giving permissions to the User associated to the Application Pool to the COM Object with CLSID {91493441-5A91-11CF-8700-00AA0060263B}.
Except there isn't one. I cannot find it.
I have Office 365 installed on my machine, and the DLL I am using is called Microsoft.Office.Interop.Powerpoint.
Question
How can I find the relevant Com Object? Is there an automated way, or do I have to manually create the keys in the Registry?

C# UWP app COM error: 80040154 Class not registered

I have an UWP application that I would like to interface with another program (Wirecast). The approach suggested by Wirecast is to call the following code:
Type objClassType = Type.GetTypeFromProgID("Wirecast.Application");
_Wirecast = Activator.CreateInstance(objClassType);
When I call this code from UWP app I get the following error:
System.Runtime.InteropServices.COMException: 'Creating an instance of
the COM component with CLSID {A416C15B-A073-4994-8DB5-87527A41B2FA}
using CoCreateInstanceFromApp failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)).
I checked the CLSID and it appears correctly in the Registry Editor. I tried compiling for x64 and x86 configurations with the same results.
When I try compiling this example in WPF project it works as expected.
Is there any way to use this COM object with an UWP app?
Unfortunately this won't work as UWP runs in a sandbox and it cannot communicate with COM. If you want such functionality, you would have to create a local service via which would your UWP app communicate with the program or a Brokered Windows Runtime Component which has no limitations but will prevent your app from being published to Microsoft Store.

Adding site Binding programmatically IIS 7.5

I am trying to add site binding programmatically. Here is my code:
using (ServerManager manager = ServerManager.OpenRemote("serverName"))
{
manager.Sites["siteName"].Bindings.Add(string.Format("*:{1}:{0}.localhost", clientCode, port), "http");
manager.CommitChanges();
}
I am getting the following Error. How do I get around this?
UnAuthorizedException: Retrieving the COM class factory for remote component with CLSID {} from machine failed due to the following error: 80070005
The account runs the code must be the administrator of the remote machine and also the DCOM related ports on the remote machine must be opened at firewall.

stonefield query web application cannot publish

i have problem publishing my web application on IIS. i'm using stonefield query tools which using SQProxyWrapper component.
When i publish the page on IIS i got this error:
Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {F83BAE78-C971-4083-B191-64AE6790104E} failed due to the following error: 80070005.
[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {F83BAE78-C971-4083-B191-64AE6790104E} failed due to the following error: 80070005.]
SQProxyWrapper.SQProxy..ctor() +26
I believe that the component 'SQProxyWrapper' is blocked. The stonefield query use 2 dll SQProxyWrapper.dll and SFQWrapper.dll . is there anything that i need to do to this 2 dll before publishing the web application to IIS?
I tried to put the whole files and folders security to full access to everyone but no luck I still got the same error.

Categories

Resources