C# 试图读取或写入受保护的内存。这通常表示其他内存已损坏
当我尝试使用“cablib.extract.extractFiles”方法提取.cab文件时,我遇到了以下错误。 我正在使用 windows server 2003 sp2, .NET2.0, iis 6.0和 cablib.dll版本为8.1.0.0 错误是:C# 试图读取或写入受保护的内存。这通常表示其他内存已损坏,c#,iis-6,.net-2.0,windows-server-2003,C#,Iis 6,.net 2.0,Windows Server 2003,当我尝试使用“cablib.extract.extractFiles”方法提取.cab文件时,我遇到了以下错误。 我正在使用 windows server 2003 sp2, .NET2.0, iis 6.0和 cablib.dll版本为8.1.0.0 错误是: Server Error in '/' Application. -------------------------------------------------------------------------------- Att
Server Error in '/' Application.
--------------------------------------------------------------------------------
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error:
Line 2205:
Line 2206: string strFilePath = strTmpCabPath + "\\" + strFile;
Line 2207: i_Extract.ExtractFile(strFilePath, strTempDir);
Line 2208:
Line 2209: string XmlPath = Server.MapPath(CCommon.COMMON_RESOURCE_FILE_XML);
Source File: d:\wwwroot\WebPages\FileUpload.aspx.cs Line: 2207
Stack Trace:
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
new(UInt32 ) +0
CUtf7.Encode(CUtf7* , UInt16* u16_In) +232
CExtractT<CExtract>.SetDecryptionKeyW(CExtractT<CExtract>* , UInt16* u16_DecryptKey) +78
CabLib.Extract.ExtractFile(String s_CabFile, String s_Folder) +243
FileUpload.WriteToDatabase(String strFileName, Byte[] arrFileBytes) in d:\wwwroot\WebPages\FileUpload.aspx.cs:2207
FileUpload.FileUploadFunc(String strFilePath, String strFileName, Boolean bOtherDocs) in d:\wwwroot\WebPages\FileUpload.aspx.cs:2530
FileUpload.btnUpload_Click(Object sender, EventArgs e) in d:\wwwroot\WebPages\FileUpload.aspx.cs:982
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618
“/”应用程序中出现服务器错误。
--------------------------------------------------------------------------------
试图读取或写入受保护的内存。这通常表示其他内存已损坏。
描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源。
异常详细信息:System.AccessViolationException:尝试读取或写入受保护内存。这通常表示其他内存已损坏。
源错误:
第2205行:
第2206行:字符串strFilePath=strtmpcapath+“\\”+strFile;
第2207行:i_Extract.ExtractFile(strFilePath,strTempDir);
第2208行:
第2209行:字符串XmlPath=Server.MapPath(ccomon.COMMON\u RESOURCE\u FILE\u XML);
源文件:d:\wwwroot\WebPages\FileUpload.aspx.cs行:2207
堆栈跟踪:
[AccessViolationException:尝试读取或写入受保护的内存。这通常表示其他内存已损坏。]
新(UInt32)+0
CUtf7.编码(CUtf7*,UInt16*u16_英寸)+232
cextract.SetDecryptionKeyW(cextract*,UInt16*u16_DecryptKey)+78
Extract.ExtractFile(字符串s_CabFile,字符串s_Folder)+243
d:\wwwroot\WebPages\FileUpload.aspx.cs:2207中的FileUpload.WriteToDatabase(字符串strFileName,字节[]arrFileBytes)
d:\wwwroot\WebPages\FileUpload.aspx.cs:2530中的FileUpload.FileUploadFunc(字符串strFilePath、字符串strFileName、布尔值)
FileUpload.btnUpload\单击d:\wwwroot\WebPages\FileUpload.aspx.cs:982中的(对象发送者,事件参数e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e)+111
System.Web.UI.WebControl.Button.RaisePostBackEvent(String eventArgument)+110
System.Web.UI.WebControl.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)+10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)+36
System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+1565
--------------------------------------------------------------------------------
版本信息:Microsoft.NET Framework版本:2.0.50727.3615;ASP.NET版本:2.0.50727.3618
什么是i_Extract.ExtractFile(strFilePath,strTempDir);?它是如何定义的?我们是想猜测是什么代码产生了这个跟踪吗?因为如果这是你的意图,你不会得到太多帮助。你的问题是什么?猜测它可能很容易,但仍然应该显式地声明它。请与库所有者联系以获得支持。i_Extract是Cablib.Extract类的实例