Hi All,
We have a gallery component that allows us to upload images.
An Edit Image Entry user control allows the user to update an image, by
replacing the current one.
Oddly, after replacing an image, if the user tries to replace again
within a few seconds - he gets the following error message:
The process cannot access the file "...X.gif" because it is being used
by another process.
If we wait for over 20 seconds or so, this doesn't happen.
Also, once we get this error, the file then stays locked untill the
w3wp.exe process is killed (or debugging is stopped).
Help!
Thanks,
Uri
CodeOasis.com 8 5152
Sounds like the upload completes and passes the file write off to the file
system, which has not yet completed actually repacing the file - even though
the instruction to start has has completed. I dont think there would be
anyhting you can do about it other than make some informative error
handling. You might try checking that the file can be opened exclusively
before you try and overwrite it or seeing if you can stall the asp page
concluding by getting areturn value from the file write.
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
<ut*****@gmail. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hi All,
We have a gallery component that allows us to upload images. An Edit Image Entry user control allows the user to update an image, by replacing the current one.
Oddly, after replacing an image, if the user tries to replace again within a few seconds - he gets the following error message:
The process cannot access the file "...X.gif" because it is being used by another process.
If we wait for over 20 seconds or so, this doesn't happen.
Also, once we get this error, the file then stays locked untill the w3wp.exe process is killed (or debugging is stopped).
Help!
Thanks, Uri CodeOasis.com
Hi John,
In the two methods that I've tried using to write the file, there is no
return value that I can wait for. The methods were:
1) HtmlInputFile's .PostedFile.Sav eAs(...)
2) Creating a FileStream object and using its write method. In this
case, I did wait for the InputStream to finish reading (uploading) the
file and give me a return value.
Both solutions did not help...
I am also disposing of all related objects, BTW.
I find it very strange that the file system would keep a lock on a file
for so long after all handles have been detroyed.
Naturally, I am taking care of showing a more subtle error message to
the user. Moreover, this scenario is not expected to happen often.
However, I would like to get to the bottom of this - to know what's the
cause. I hate 'turning a blind eye' to this sort of thing, as it tends
to come back and 'bite you in the ass'...
Thanks!
Just shooting in the dark...
If it is a timing issue, maybe the same code that saves the file to disk
could also immediately try to access the file after the write. (This could be
something as simple as querying the FileSystemInfo. ) Doing this in the same
code may give the system enough time to complete anything that is causing it
to hang.
Are there a lot of files in the directory? A large directory could put a
greater burden on the file system. This could be requiring more time to
complete background operations.
"ut*****@gmail. com" wrote: Hi John,
In the two methods that I've tried using to write the file, there is no return value that I can wait for. The methods were: 1) HtmlInputFile's .PostedFile.Sav eAs(...) 2) Creating a FileStream object and using its write method. In this case, I did wait for the InputStream to finish reading (uploading) the file and give me a return value. Both solutions did not help... I am also disposing of all related objects, BTW.
I find it very strange that the file system would keep a lock on a file for so long after all handles have been detroyed. Naturally, I am taking care of showing a more subtle error message to the user. Moreover, this scenario is not expected to happen often.
However, I would like to get to the bottom of this - to know what's the cause. I hate 'turning a blind eye' to this sort of thing, as it tends to come back and 'bite you in the ass'...
Thanks!
Is the file accessed through HTTP before or after being uploaded ? AFAIK
when you access a file through HTTP, IIS lock the file for a "short" period
(I would say 60 s by default ?).
If you are in this case, you could likely stream the file to the browser to
avoid HTTP access...
Patrice
--
<ut*****@gmail. com> a écrit dans le message de
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . Hi John,
In the two methods that I've tried using to write the file, there is no return value that I can wait for. The methods were: 1) HtmlInputFile's .PostedFile.Sav eAs(...) 2) Creating a FileStream object and using its write method. In this case, I did wait for the InputStream to finish reading (uploading) the file and give me a return value. Both solutions did not help... I am also disposing of all related objects, BTW.
I find it very strange that the file system would keep a lock on a file for so long after all handles have been detroyed. Naturally, I am taking care of showing a more subtle error message to the user. Moreover, this scenario is not expected to happen often.
However, I would like to get to the bottom of this - to know what's the cause. I hate 'turning a blind eye' to this sort of thing, as it tends to come back and 'bite you in the ass'...
Thanks!
Thanks Brad,
I have tried your approach and unfortunately it produced no effect.
To your question: there are very few files in the directory at this
point (less than 10) - so I doubt that this could be a factor.
Also - what background operations could there be? We're waiting for
everything to complete, and then destroying the handles...
Uri.
Hi Patrice,
I'm affraid I don't know what you mean by 'streaming' the file to the
browser. I'm using regular access as an <img> tag. The upload takes
place using an HtmlInputFile control, which I assume uses HTTP to
transfer the file.
I've researched a little about this (shocking) lock that IIS places on
files. I've even used a registry setting to try to disable it, but that
didn't work.
To disable the caching, I've used the steps described for IIS4 in: http://support.microsoft.com/default...EN-US;q191742& -
namely: enter a DWORD value in
HKEY_LOCAL_MACH INE\SYSTEM\Curr entControlSet\S ervices\InetInf o\Parameters
called DisableMemoryCa che with a value of 1.
I don't know if this didn't help because I'm using IIS 6, or because my
problem is not related to this locking (although it sounds quite
right).
Thanks,
Uri.
I meant calling an ASPX page that uses "Response.Write File" to output the
file to the browser. This way the file is not served directly by IIS.
For the upload you upload the *content* of the file using HTTP but this is
your code that creates the final file, not IIS...
Another culprit could be index server or an antivirus software maybe ? You
may want to try the filemon utility (from http://www.sysinternals.com/). It
should hopefully allow to find out what exactly locks this file before
trying a solution...
Good luck.
Patrice
--
"tagger" <ut*****@gmail. com> a écrit dans le message de
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hi Patrice,
I'm affraid I don't know what you mean by 'streaming' the file to the browser. I'm using regular access as an <img> tag. The upload takes place using an HtmlInputFile control, which I assume uses HTTP to transfer the file.
I've researched a little about this (shocking) lock that IIS places on files. I've even used a registry setting to try to disable it, but that didn't work. To disable the caching, I've used the steps described for IIS4 in: http://support.microsoft.com/default...EN-US;q191742& - namely: enter a DWORD value in HKEY_LOCAL_MACH INE\SYSTEM\Curr entControlSet\S ervices\InetInf o\Parameters called DisableMemoryCa che with a value of 1. I don't know if this didn't help because I'm using IIS 6, or because my problem is not related to this locking (although it sounds quite right).
Thanks, Uri.
Hi All,
Well, Patrice's last advice finally nailed it!
I used one of the excellent tools on sysinternals.co m (procexp.exe)
while tracing through the code, and found the culprit: ME!
At some point in the program, I had opened a Bitmap object just to get
the height and width of the image, and forgot to dispose of this
object. This had kept an open handle on the file, and wouldn't let me
try to overwrite it...
Thanks to everyone for your help, and thanks to Patrice for providing
the eventual remedy.
Uri. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Helge |
last post by:
I'm developing a web site with asp.net, mainly vb on a Windows 2003 server.
Quite often the web site stops responding for 15-20 seconds.
A web page that usually take 2 seconds to produce takes forever.
During this time,the w3wp process takes 100% of the CPU time.
I'm using only asp.net, no extra stuff like Commerce server or anything.
Please? Any clues or help would be much appreciated!
Helge
|
by: Charles Law |
last post by:
Hi guys
I have a time critical process, running on a worker thread. By "time
critical", I mean that certain parts of the process must be completed in a
specific time frame. The time when the process starts is not especially
important, but it must be complete within a small number of seconds.
The operations I am performing do not take a long time (hundreds of
milliseconds), but as each part of the process is complete, my worker thread...
|
by: Prince Kumar |
last post by:
I joined a company recently and they have a java program which hangs
(does nothing) after a while. This is no way consistent. It could
succeed quite a few times and can fail a few other times. There is no
consistency when it fails.
Could anyone here shed some light on how to debug/resolve the issue. I
guess IBM looked at the issue and were not able to pinpoint where the
issue is.
When the program hangs and when force the DB2...
|
by: z. f. |
last post by:
Hi,
i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL.
for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it can't compile because the DLL is in use (and the PDB too), and the w3wp.exe process is the process locking the DLL (as viewed with Sysinternals - Process Explorer).
this is a huge problem. i need to do IIS reset in order to free the DLL!
1. why is...
|
by: Tod Birdsall |
last post by:
Hi All,
The organization I am working for has created a new corporate website
that used Microsoft's Pet Shop website as their coding model, and
dynamically served up content, but cached each page by content ID. The
site appears to be working well. It is hosted on a Windows 2003 server
with 2 Gigs of RAM. It was built using Visual Studio .NET 2005 and us
running under the .NET Framework 2.0 Beta
The Issue :
| |
by: mcollier |
last post by:
I am experiencing high CPU utilization with my ASP.NET application.
The w3wp.exe process uses 75%-80% CPU for about 10 seconds. I notice
this when the application first starts up, which I can partially
understand since ASP.NET compiles the application on the first access.
However, I also notice the high CPU usage by w3wp.exe after long
periods of inactivity. For example, if I stop using the site for 30
minutes, and then come back to the...
|
by: AN |
last post by:
Greetings,
We make an ASP.NET web application and we host it for our customers. We
have provisioned hardware and hope to be able to service around 200
customers on this hardware. The web servers are in a stateless farm and
have 2 GB of RAM. We are using ASP.NET 1.1 when using a dedicated
application pool for each virtual directory. Each customer gets their own
virtual directory and copy of the ASP.NET dll in their bin folder, which...
|
by: Propertyshowrooms |
last post by:
Hi all,
I know this is probably an easy problem to fix, or at least I hope so, but for the life of me I can't figure out why the Private Bytes in my w3wp.exe process just keeps climbing until the application pool gets recycled. I have tried all the usual approaches to the problem such as ensuring all db connections are closed and killed off, making sure there are no infinite loops (well i tried to, hard to know) etc. No matter what I try, the...
|
by: violeta123 |
last post by:
I am stuck! Please help
It might be difficult to explain the problem via email, but I will try.
I have a Win 2003 Enterprise server running with the only purpose of a membership web site that uses SQL server 2000 database. I had the site for over 5 years, but the problem started about 6 months ago. At random times (at least I have not found yet any particular time or event when it happens), the Web site Times-out and so the SQL server....
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |