Hi,
I have an ISAPI, and I need to call a VB dll, but the dll fails to initialize.
Microsoft said that it shoud work but I don't find the way to call that dll.
The dll is registered and I import it like this:
Code:
#import "XRSTest_apartment.dll"
Also initialize it in the HttpExtensionProc as microsoft says in Q289112
Code:
DWORD CTestExtension::HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB)
{
HRESULT hr;
//hr = CoInitializeEx(NULL,COINIT_MULTITHREADED );
hr = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED );
if (FAILED(hr)) {
saveLOG( _T("CoInitialize failed"));
return HSE_STATUS_ERROR;
}
return CHttpServer::HttpExtensionProc(pECB);
}
Try to use it in the Default()
Code:
void CTestExtension:: Default(CHttpServerContext* pCtxt)
{
HRESULT hr;
StartContent(pCtxt);
WriteTitle(pCtxt);
*pCtxt << _T("This default message was produced CTestExtension:: Default()");
*pCtxt << _T("<br>");
// Initialize and instance of the automation server for this thread
XRSTest::_TestPtr pItf;
// create the reference --> fails here
hr = pItf.CreateInstance(L"XRSTest.Test");
if (FAILED(hr)) {
saveLOG( _T("XRSTest_apartment CreateInstance failed"));
return;
}
*pCtxt << _T(pItf->GetString());
// Unitializes the COM library
EndContent(pCtxt);
}
My question is why does it fail?
I will attach the project (MSVS:NET 2003), inside you find the dll, and cmds to register it, also cmds to copy it to the wwwroot.
If you can help please do it, I have been some days stuck here.
Atention! the file is 6.4 MB as I attach debug info and all.
Thank you
froque