Calling MFC code from WebService

  • Thread starter Christopher Kimbell
  • Start date
C

Christopher Kimbell

Hi,
I am trying to make data that is retrieved from old MFC code available
through a WebService.

I created a Winform application for test purposes and got the
managed/unmanaged code to work.
When I tried the same in the WebService, I got a FileNotFoundException on
one of the MFC dll's.
After some investigation, I added the MFC dll location to the path.
Previously I tried to copy them
to the bin folder but discovered that the assemblies are moved to a
temporary folder,
without my old MFC dll's.

After modifying the path, I get an Internal Server Error. When I enable
Unmanaged debugging,
it is successful in attatching to the process but nothing else, the test
page for WebServices doesn't
come up, I gave up after several minutes. Managed debugging works.

When I developed my Winforms test application, I had to call AfxWinInit() to
initialize MFC,
is this required when the call comes from a WebService?

If anybody has any ideas, pointers, references on the topic, any help would
be apreciated.

Chris
 
R

richlm

I suspect the behaviour is due to your web service not having sufficient
permissions to run unmanaged code - this is the default.

There are 2 possible approaches:
1. customize the security policy for your particular WS app
2. "sandbox" the code that calls the unmanaged code in a separate assembly,
and give that assembly the extra privilege.

The 2 are described quite well here - together with advice on deciding on
the best approach:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh09.asp

My guess is you will still need to call AfxWinInit() from your WS.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top