我用VC6的ATL COM AppWizard写了一个组件DataCache.GPSCache,它有如下几个函数:
1.RefreshCache(int *ret)
2.GetUnReadMsgCount(BSTR group_ids, int *ret)
3.GetTrackData(BSTR vids, BSTR *ret)
4.GetUnProcessAlarm(BSTR group_ids, BSTR *ret)我先写了一个VC下的定时刷新程序,调用函数RefreshCache,运用的是智能指针,这个在web服务器端运行:
void CCacheFreshDlg::OnTimer(UINT nIDEvent)
{
try
{
IGPSCachePtr pPtr1=IGPSCachePtr(__uuidof(GPSCache));
int cnt;
HRESULT hr=pPtr1->raw_RefreshCache(&cnt);
if(FAILED(hr))
{
//LogInfoTime("刷新错误!");
LogInfoTime("重新创建COM组件实例2!");
//IGPSCachePtr m_pPtr1=IGPSCachePtr(__uuidof(GPSCache));
}
}
catch(_com_error &e)
{
LogComError(e);
LogInfoTime("重新创建COM组件实例!");
//m_pPtr1=IGPSCachePtr(__uuidof(GPSCache));
return;
}
CDialog::OnTimer(nIDEvent);
}
再在asp里调用除RefreshCache外的其他函数,调用GetUnReadMsgCount是这样的:
dim objCache,iCount
Set objCache = server.CreateObject("DataCache.GPSCache.1")
iCount=objCache.GetUnReadMsgCount(groupRight)
response.write iCount
set objCache = nothing
然后在我的客户端程序里每按10秒调用这些asp若开上30个这样的客户端程序(其中调用有组件函数的asp),就会经常出现如下问题:
1.服务器端经常出现"dllhost.exe - 应用程序错误"的错误窗口
2.服务器的IIS无故停止
1.RefreshCache(int *ret)
2.GetUnReadMsgCount(BSTR group_ids, int *ret)
3.GetTrackData(BSTR vids, BSTR *ret)
4.GetUnProcessAlarm(BSTR group_ids, BSTR *ret)我先写了一个VC下的定时刷新程序,调用函数RefreshCache,运用的是智能指针,这个在web服务器端运行:
void CCacheFreshDlg::OnTimer(UINT nIDEvent)
{
try
{
IGPSCachePtr pPtr1=IGPSCachePtr(__uuidof(GPSCache));
int cnt;
HRESULT hr=pPtr1->raw_RefreshCache(&cnt);
if(FAILED(hr))
{
//LogInfoTime("刷新错误!");
LogInfoTime("重新创建COM组件实例2!");
//IGPSCachePtr m_pPtr1=IGPSCachePtr(__uuidof(GPSCache));
}
}
catch(_com_error &e)
{
LogComError(e);
LogInfoTime("重新创建COM组件实例!");
//m_pPtr1=IGPSCachePtr(__uuidof(GPSCache));
return;
}
CDialog::OnTimer(nIDEvent);
}
再在asp里调用除RefreshCache外的其他函数,调用GetUnReadMsgCount是这样的:
dim objCache,iCount
Set objCache = server.CreateObject("DataCache.GPSCache.1")
iCount=objCache.GetUnReadMsgCount(groupRight)
response.write iCount
set objCache = nothing
然后在我的客户端程序里每按10秒调用这些asp若开上30个这样的客户端程序(其中调用有组件函数的asp),就会经常出现如下问题:
1.服务器端经常出现"dllhost.exe - 应用程序错误"的错误窗口
2.服务器的IIS无故停止
我使用COM+的时候,如果组件内部有错误,比如delete 野指针等,也会出现dllhost.exe - 应用程序错误"错误的根源在你组件的内部,可以检查 内存分配释放
只能帮你把错误方位缩小,解决方法没有算是帮你顶了