Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2006

Tip: Looking for answers? Try searching our database.

Problem in Calling native code from managed c++ dll.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Haroon_Saeed - 31 Jul 2006 15:47 GMT
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.
Jochen Kalmbach [MVP] - 01 Aug 2006 09:05 GMT
Hi Haroon!

> 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
[quoted text clipped - 4 lines]
> native code starts( mean native class's objects are instatiated). Can
> any one help me in this regard. It's kinda hurry. Thanks.

What is the exact expection message?
It might have to do with the "security" settings; which might not allow
to call unmanaged code.

Greetings
  Jochen
adebaene@club-internet.fr - 01 Aug 2006 13:14 GMT
> Hey,
>
[quoted text clipped - 6 lines]
> 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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.