Hello,
I try to create a webservice with VS2010 and .Net 4.
This service has to execute unsafe code from an external Delphi-Dll.
I have also created a console application which uses the same code and it works well.
But when I execute the webservice I get error messages caused by executing code in the protected memory.
Is there a configuration setting to use unsafe code in a webservice?
Regards,
sweisse
Loading
Steffen WeissePosted Nov 23, 2011, 2:52 AM
But in the meantime I found the reason I think.
Indeed it is an unhandled exception in my Delphi-Dll.
There was a necessary file in the web service execution directory (..\Microsoft Shared\DevServer\...) missing.
This case does never happen when I execute the console application because all the file are present in my normal application directory.
The Dll uses the function
ExtractFilePath(Application.Exename)
and this is different in case of running as webservice.
Thank you for your help.
VulpesPosted Nov 22, 2011, 8:40 AM
"An attempt was made to read or write protected memory. This is often an indication that other memory is corrupt."
which, IIRC, is the error message you get when an AccessViolation exception is thrown.
However, the function's signature certainly seems innocuous enough.
When you called it from the console application, did you use exactly the same signature and pass it the same argument?
Steffen WeissePosted Nov 22, 2011, 7:57 AM
the german error message is
"Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist."
VulpesPosted Nov 22, 2011, 6:57 AM
Also are you using P/Invoke or COM interop to call functions in the Delphi dll?
Steffen WeissePosted Nov 22, 2011, 6:03 AM
The compiler switch was set for the buid options but not in the web.config.
I have adjusted this but I still get the same result.
VulpesPosted Nov 22, 2011, 4:54 AM