I have a requirement to call a dll (unmanaged c) from a .NET web service (asmx or WCF).
Calling the dll from the web service is straightforward and works as expected.
However, issues emerge when I load test the web service. (error code 0xC0000374 - "an internal error, typically involving heap corruption”).
I've been informed by the owner of the dll that the dll isn't reliable in a multi-threaded environment if 2 or more calls are sent at the same time.
In a traditional windows app, I'd deal with this by implementing a singleton class to protect the dll. Is there a recommended approach for achieving this in a web service implementation?