当前线程不在单线程单元中,因此无法实例化 ActiveX 控件

 

 

“/”应用程序中的服务器错误。

当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“c552ea94-6fbb-11d5-a9c1-00104bb6fc1c”。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.Threading.ThreadStateException: 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“c552ea94-6fbb-11d5-a9c1-00104bb6fc1c”。

源错误: 


行 17: {
行 18:     MapManager m_pMapManager;
行 19:     ESRI.ArcGIS.Controls.AxMapControl MapCtrl = new AxMapControl();
行 20: 
行 21:     List<IPoint> m_ArrCutLinePoints = new List<IPoint>();  
源文件:      行: 19 

堆栈跟踪: 


[ThreadStateException: 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件“c552ea94-6fbb-11d5-a9c1-00104bb6fc1c”。]
   System.Windows.Forms.AxHost..ctor(String clsid, Int32 flags) +3705969
   System.Windows.Forms.AxHost..ctor(String clsid) +11
   ESRI.ArcGIS.Controls.AxMapControl..ctor() +57
   
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678

 

在aspx  page标签中添加 

AspCompat="true"

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"  AspCompat="true"%>

 

posted @ 2017-03-04 13:47  leechg  阅读(2623)  评论(1编辑  收藏  举报