Server Application Unavailable

G

Guest

Hi,

I have written an HTTPModule that calls functions from a DLL using PInvoke.
I am only registering for a couple events, and they are BeginRequest,
PreRequestHandlerExecute, and EndRequest. In BeginRequest, I have some code
that calls this DLL which works just fine. In PreRequesthandlerExecute, I
have similar code that gives me the Server Application Unavailable error.
Here is code that is fine in BeginRequest and buckles in
PreRequesthandlerExecute:

<code>
IntPtr buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(bufferStructure);
Marshal.StructureToPtr(bufferStructure, buffer, true);
startBuffer.array = buffer;
Marshal.FreeCoTaskMem(buffer);

int error = startMeasurement(ref startBuffer); // Causes error

Now, if I don't free the memory before the call, the call returns an error.
If I do free the memory I get the server application unavailable error. If I
make the pointer null, the call works just fine. It is only when I use the
structure that contains a marshalled pointer in it in the
PreRequesthandlerExecute that I see the problem. The exact same code runs
just fine in the Beginrequest.

I am running this on IIS 6.0 and Windows Server Standard 2003.

If you have any idea of what the problem is, please help!

Thanks,

kat
 

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
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top