aspnet_wp will not release file handle

Tech-Archive recommends: Fix windows errors by optimizing your registry

fernandez.dan_at_gmail.com
Date: 02/11/05


Date: 11 Feb 2005 12:31:09 -0800

I have a umangaged dll ( I have the source code) which I use in my web
app using pinvoke. The dll creates a file, writes to it, and then
closes it. It works the first time through but the second time through
it can't open file so my dll fails and returns an error number.

I then try to delete the file manually but it says that I can not
delete it because it is use by other program or user. I used process
explorer utility from sysinternals to find out who had the file handle.
It seems that the aspnet_wp has the file handle.

It's weird if I wait for a long period of time, I can finally manually
delete the file. I'm not sure if it takes a period of time for the
aspnet_wp process to release resources.

Just an high overview of the file call sequence in my unmanaged dll
int pMode = 0x20;
hFile = CreateFile(filename,GENERIC_WRITE,0, NULL, CREATE_ALWAYS,
pMode, NULL);
WriteFile(hFile,cmdstring,strlen(cmdstring), &bytes,NULL);
CloseHandle(hFile);

I appreciate any advice.



Relevant Pages

  • Re: Having trouble with pInvoke to my custom C++ dll
    ... How c++ dll is declared? ... > winforms app. ... > default the wizard creates a sample function and exports it. ... > pInvoke fine into other system dlls, so what am I doing wrong? ...
    (microsoft.public.dotnet.framework.interop)
  • Re: aspnet_wp will not release file handle
    ... Does your .NET code use the file at all? ... Or just the unmanaged dll? ... >Just an high overview of the file call sequence in my unmanaged dll ... >int pMode = 0x20; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Firefox and Sound
    ... number of loads that app performed. ... only references to entry points in the dll. ... specified entry points in it can't be found, ... but the download manager said it was only 78.8 MB. ...
    (comp.os.os2.apps)
  • Re: New Delphi roadmap is coming: NO UNICODE PLEASE!
    ... Avoids DLL hell, because it ... The app is deployed and the user is getting an error. ... instances where upgrading .NET broke things that were working. ... Coming from Delphi, this isn't any big deal of course. ...
    (borland.public.delphi.non-technical)
  • Re: What programming language for Future
    ... usually when apps come with scripts, those scripts are for that version ... version of the app. ... Which is exactly the same as when the compiler is shipped with the app. ... for the sole reason that they can't rebuild a working dll. ...
    (comp.lang.misc)