使用webBrowser截图时出现这样一个错误:

当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“8856f961-340a-11d0-a96b-00c04fd705a2”

查找了下,大部分人说的解决方法如下:

System.Threading.ThreadStart start = new System.Threading.ThreadStart(download);
System.Threading.Thread th
= new System.Threading.Thread(start);
th.ApartmentState
= System.Threading.ApartmentState.STA;//关键
或者

[STAThread]
static void Main(string[] args)
{
}

而我最后使用的解决办法是在页头加上AspCompat="true"属性即可,不妨试试看...

相关文章:

  • 2022-12-23
  • 2021-06-18
  • 2022-01-15
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
猜你喜欢
  • 2021-05-22
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案