IIS使用COM获得Class未注册的异常
问题描述:
我用WinForm托管我的COM组件,并在IIS中启动它,它在测试期间在VS中正常工作,但在发布到IIS后,我得到“class not registered”异常并且然后应用程序池崩溃。起初,我认为它与COM注册有关,但我写了一个测试winform应用程序来调用相同的COM,它在同一台服务器上工作正常。IIS使用COM获得Class未注册的异常
有人吗?
class FaceScannerServerHost : Form
{
public FaceScannerServerHost(Control control, bool hidden = false)
{
if (control.IsHandleCreated) throw new InvalidOperationException("control already committed to wrong thread");
if (hidden) this.Opacity = 0;
this.Hide();
this.ShowInTaskbar = false;
using (initDone = new ManualResetEvent(false))
{
thread = new Thread((_) =>
{
try
{
//COM control
AxC_FaceServerSdk axc = (AxC_FaceServerSdk)control;
this.Controls.Add(axc);
//crashed here
Application.Run(this);
}
catch (Exception exp)
{
TraceLog.Debug("AxServer", exp.Message);
}
});
thread.IsBackground = true;
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
initDone.WaitOne();
}
}
答
选项:
- 是asp.net注册到您的IIS?
- 检查应用程序池中的框架。
- 启用目录浏览。
- 确保包含所有的dll。
- 检查是否32位或64位服务器。
只是点5 ..我认为COM是32位,但我不知道如何处理这个。 –