George Abraham-5 wrote:
> 
> I want to create an MSI to deploy a COM+ application. I could create the
> MSI to do so, but, I could not find a way to change the Activation to "Run
> application as NT Service". Is this possible using the COM+ custom action?
> If not any ideas on how to approach the problem?

My installation does exactly that, however I couldn't find a way how to do
it with the COM+ CA.
So I've written a DLL in C to register COM+ applications which match a given
pattern as a service and remove them on rollback/uninstall again. Not
elegant, escpecially because I'm no C developer, but it works.

Some snippets in case anyone needs them:


#include <comdef.h>
#import "Comadmin.dll" no_namespace
[...]
CoInitialize (NULL);
ICOMAdminCatalog2Ptr comCatalog("COMAdmin.COMAdminCatalog");
ICatalogCollectionPtr comApplications = NULL;
ICatalogObjectPtr comApp = NULL;
// Get all COM+ applications
comApplications = comCatalog->GetCollection(L"Applications");
comApplications->Populate();
comApplications->get_Count(&count);
[...]
// Register all COM+ applications which start with "Foo.Bar." as NT services
for(int i = 0; i < count; i++) {
        comApplications->get_Item(i, (IDispatch**)&comApp);
        _variant_t appName;
        comApp->get_Name(&appName);
        _bstr_t bAppName(appName);
        if (strncmp(bAppName, "Foo.Bar.", 8) == 0) {
                try {
                        comCatalog->CreateServiceForApplication (bAppName, 
bAppName, bStartMode,
L"SERVICE_ERROR_NORMAL", L"rpcss", bUsername, bPassword, 0);
                }
                catch (_com_error &e) {
                        // error handling
                }
        }
}
[...]
comApp.Release();
comApplications.Release();
comCatalog.Release();
CoUninitialize();


I've left all MSI related stuff out. To remove the service you'd use
"comCatalog->DeleteServiceForApplication(bAppName);" instead of
"CreateServiceForApplication". MSDN will tell you more about these methods.
-- 
View this message in context: 
http://www.nabble.com/COM%2B-Activation---Run-as-NT-Service-tf2260955.html#a6305529
Sent from the wix-users forum at Nabble.com.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to