"Attempted to read or write protected memory" error when accessing COM component from C#
I have an ASP.NET application which uses an old and now unsupported third party COM component. The Application runs reliably on windows serv开发者_开发技巧er 2003, but when I try to run it on 2008 r2 or windows 7, I get the above message. Obviously i've switched the application pool into 32 bit mode.
I realise I will eventually need to replace this with a new component but for the moment I'm just trying to get this legacy app working in the new environment. I can change the C# code that calls it but I can't change the COM component itself.
any thoughts gratefully received
Andy
Try compiling your ASP.Net application targeting the x86 platform.
Edit:
Also when you recompile I would make sure to grab the new Interop it creates in relation to your COM component.
精彩评论