日期:2014-05-17  浏览次数:21957 次

WebServices初始化报错:System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。

请各路高手走过路过,给指教一下!

调用WebServices,

 SPCControllerWS.SPCSrvWS spcws = new SPCUDRVExt.SPCControllerWS.SPCSrvWS();

出现以下错误:


System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
  在 System.Signature._GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr declaringTypeHandle)
  在 System.Signature..ctor(RuntimeMethodHandle methodHandle, RuntimeTypeHandle declaringTypeHandle)
  在 System.Reflection.RuntimeMethodInfo.get_Signature()
  在 System.Reflection.RuntimeMethodInfo.get_ReturnType()
  在 System.Web.Services.Protocols.LogicalMethodInfo.IsBeginMethod(MethodInfo methodInfo)
  在 System.Web.Services.Protocols.LogicalMethodInfo.Create(MethodInfo[] methodInfos, LogicalMethodTypes types, Hashtable declarations)
  在 System.Web.Services.Protocols.SoapClientType.GenerateXmlMappings(Type type, ArrayList soapMethodList, String serviceNamespace, Boolean serviceDefaultIsEncoded, ArrayList mappings)
  在 System.Web.Services.Protocols.SoapClientType..ctor(Type type)
  在 System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
  在 SPCUDRVExt.SPCControllerWS.SPCSrvWS..ctor()
  在 SPCUDRVExt.SPCUDRVExtForm.SPCUDRVExtForm_Load(Object sender, EventArgs e)


------解决方案--------------------
这不是Webservice的问题,而是可能你调用非托管DLL引发的问题。

._GetSignature(SignatureStruct& signature, Void* pCorSig, Int32 cCorSig, IntPtr fieldHandle, IntPtr methodHandle, IntPtr declaringTypeHandle)

------解决方案--------------------
这个问题比较奇怪,感觉系统或者.net runtime坏了似的。