Haroon_Saeed wrote:
Hey,
I wrote a managed c++ class library in viusal studio 2005. This managed
c++ dll calls native C++ methods of an SDK. When I referenced this
managed c++ library in a console applciation written in C# for testing
every thing worked fine. Now I need to call the managed c++ class
library through web service written in C#. When I call managed c++
methods from web service the code crashes on the line from where the
native code starts( mean native class's objects are instatiated). Can
any one help me in this regard. It's kinda hurry. Thanks.
Generally speaking, web services run under restricted accouts and with
restricted privilieges. I'll bet you do not have the UnmanagedCode
SecurityPermission flag set when you are running under the web service.
Either mark your managed C++ with the SuppressUnmanagedCodeSecurity
attribute (but do this only if you are truly aware of the
implications!), or have your web service run under another account with
the correct permissions. In any case, you must be aware that this is a
potential security weakness to let a web service call on unmanaged,
unprotected, code.
Arnaud
MVP - VC