activex 组件运行异常
加载activex组件时出现异常,异常信息如下。而且,很奇怪的是,本地调试可以下载,但是发布到IIS上后,所有的对客户端文件的读写均没有权限。
这个问题头疼了好几天,迷迷糊糊解决了。在此记录下解决思路和方式。
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。
************** 异常文本 **************
System.UnauthorizedAccessException: 对路径的访问被拒绝。
在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
在 System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)
在 System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer)
在 System.IO.FileStream.Dispose(Boolean disposing)
在 System.IO.Stream.Close()
在 System.IO.StreamWriter.Dispose(Boolean disposing)
在 System.IO.TextWriter.Dispose()
在 DownloadActiveX.txtReadWrite.WriteLog(String context)
在 DownloadActiveX.xmlReadWrite.GetXmlElementValue(String Key)
在 DownloadActiveX.SetPath.SetPath_Load(Object sender, EventArgs e)
在 System.Windows.Forms.UserControl.OnLoad(EventArgs e)
在 System.Windows.Forms.UserControl.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.UserControl.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ActiveXImpl.System.Windows.Forms.IWindowTarget.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** 已加载的程序集 **************
mscorlib
程序集版本:4.0.0.0
Win32 版本:4.0.30319.34014 built by: FX45W81RTMGDR
基本代码:file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
DownloadActiveX
程序集版本:1.0.1.0
Win32 版本:1.0.1.0
基本代码:file:///C:/Program%20Files%20(x86)/%E9%BB%98%E8%AE%A4%E5%85%AC%E5%8F%B8%E5%90%8D%E7%A7%B0/DownloadSetup/DownloadActiveX.dll
----------------------------------------
System.Windows.Forms
程序集版本:4.0.0.0
Win32 版本:4.0.30319.33440 built by: FX45W81RTMREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
程序集版本:4.0.0.0
Win32 版本:4.0.30319.33440 built by: FX45W81RTMREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
程序集版本:4.0.0.0
Win32 版本:4.0.30319.34111 built by: FX45W81RTMGDR
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
IrisSkin2
程序集版本:2006.3.22.45
Win32 版本:2006.3.22.45
基本代码:file:///C:/Program%20Files%20(x86)/%E9%BB%98%E8%AE%A4%E5%85%AC%E5%8F%B8%E5%90%8D%E7%A7%B0/DownloadSetup/IrisSkin2.DLL
----------------------------------------
mscorlib.resources
程序集版本:4.0.0.0
Win32 版本:4.0.30319.33440 built by: FX45W81RTMREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
Accessibility
程序集版本:4.0.0.0
Win32 版本:4.0.30319.33440 built by: FX45W81RTMREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Microsoft.mshtml
程序集版本:7.0.3300.0
Win32 版本:7.0.3300.0
基本代码:file:///C:/Windows/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
----------------------------------------
System.Xml
程序集版本:4.0.0.0
Win32 版本:4.0.30319.33440 built by: FX45W81RTMREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
程序集版本:4.0.0.0
Win32 版本:4.0.30319.33440 built by: FX45W81RTMREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Windows.Forms.resources
程序集版本:4.0.0.0
Win32 版本:4.0.30319.33440 built by: FX45W81RTMREL
基本代码:file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_zh-Hans_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
调试。
例如:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
启用 JIT 调试后,任何未经处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。
****************************************************************************************************************
一开始碰到这个问题,我以为是客户端的用户权限问题,于是玩命设置权限,可是毫无结果。。。。
于是,我开始思考。。。
当ActiveX控件嵌入到web中,被发布到一个网络服务器时,控件的操作会受限于iis中身份验证。
当web中其它操作没有问题,而仅仅是activex控件的操作出现问题时,我从以下几方面考虑
1.activex是否是被信任的(继承IObjectSafty)
2.activex控件安装要数字证书(制作证书为step.exe)
3.activex控件,从测试到发布,监测其文件路径是否正确
我从这三个方面下手,重新整理了下代码,问题解决。
作者:造梦者2013
出处:http://www.cnblogs.com/lipanpan/
本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

浙公网安备 33010602011771号