-1
我用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();
}
}
只是點5 ..我認爲COM是32位,但我不知道如何處理這個。 –