InteropServices COMException when executing a .net application from a web CGI script in Windows Server 2003
Disclaimer: I have absolutely no knowledge of .net and COM.
I have a developer application that appears to be written in .net and I am trying to wrap it with a web form (cgi-bin Perl script), so I can end up running this provider application from a separate machine. I am on Windows Server 2003 R2 SE SP1 and I am using Apache 2.2 for the web server and ActivePerl 5.10.0.1004 for the cgi script. My cgi script calls a vendor application that is on the same machine using Perl's backtick statement.
...
$result = "Result: " . `$vendorsPath/$vendorsExecutable $arg1 $arg2`;
...
Right now I just run the IE web browser locally on the server machine and access http: //localhost/cgi-bin/myPerlScript.pl . "The vendor app crashes and logs a debug message containing the following stack trace (I changed a couple of names to not give out the vendor ID):
...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80043A1D): 0x80040154 - Class not registered
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
at VendorsTool.Engine.Core.VendorsEngine.LoadVendorsServices(String fileName, String& projectCommPath)
...
When I run the provider app from the windows command line on the server machine with the same arguments as the cgi script, it works fine, so there is something about calling my app through the web script to cause the problem. This is probably a security issue because it all works fine on a Windows XP Pro machine (both in the command line and in a web call). I actually developed my website script there and got it fully working there before I tried to move it to a Windows Server 2003 machine. So what has changed regarding the Windows Server 2003 machine that will prevent the .net provider application from running successfully with using a web cgi script?
Is there any way I can fix this problem to make it work on my server, or should the vendor make changes to their .net application and push the new version? I'm probably the only person in the world trying to execute this vendor application from a separate program, so I don't want to bother the vendor with a problem if there is a workaround that I can implement here on my server. Also, I'm in a hurry and I don't want to wait 4 or 6 months for the vendor to install the hotfix and deploy the new version.
Thanks for any advice you can give.
a source to share
It looks to me like you have a permission issue. It looks like your .NET application is trying to use a COM object and it doesn't have enough privileges to do so.
Every COM object (COM server) has launch / activation and access rights (just start dcomcnfg
and see the DCOM configuration of some famous applications). In relation to dcomcnfg
(Component Services), you can not only see but also change these permissions (select the application and open the properties dialog from the context menu. Then select the Security tab, select Configure under Launch and Activation Permission, and click "Change"). A common problem is that INTERACTIVE users have Launch / Activate rights for most COM objects, but processes that run as services are not members of this group. Thus, you must configure permission by granting for a specific account (used by your Apache web server) or group (for exampleIIS_IUSRS
) the same launch permission given to INTERACTIVE users. This permission information will be stored in the key subsection HKEY_CLASSES_ROOT\AppID
(see Binary Value AccessPermission
).
To identify the COM object that is causing the problem, I recommend you Process Monitor (see http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx ) and Process Explorer (see http: // technet. microsoft.com/en-us/sysinternals/bb896653.aspx ). Process Monitor can help you figure out exactly what processes your program is running ( $vendorsExecutable
). One of the last calls to is HKEY_CLASSES_ROOT
used to launch a COM object. You will find out exactly which process. Remember to run these tools under an account with full administrator rights (this problem usually does not exist on the server). To quickly find the information you need, use the process name filter and search functions in Process Monitor.
If this is your first time doing this kind of work, it can look very difficult. It's not easy, but everything has a well-defined logic, and I'm sure you are solving this problem.
a source to share
The typical reason is that you haven't set a prerequisite. It's hard to say that since COM classes are used by many applications.
One way to find out the missing class is with the sysinternals process monitor tool . It can be used to montior use the registry. This will help you figure out exactly which class is trying to load the script. Named COM Classes are in
HKEY_LOCAL_MACHINE\SOFTWARE\Classes
and their base GUID record is in
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID
If Apache looks for an entry in there but doesn't find it, it might be a COM class, the perl script is missing.
a source to share
Please tell me if it helps: When registering the ATL server, the error message "0x80040154 (unregistered class)
Depending on what tools the developer has developed for their application, this could be caused by registering a DLL that is not actually registered on your Windows Server 2003.
a source to share