2017-04-20 51 views
-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(); 
     } 
    } 

回答

0

选项:

  1. 是asp.net注册到您的IIS?
  2. 检查应用程序池中的框架。
  3. 启用目录浏览。
  4. 确保包含所有的dll。
  5. 检查是否32位或64位服务器。
+0

只是点5 ..我认为COM是32位,但我不知道如何处理这个。 –