Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - File being used by another process
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

File being used by another process

 Post Reply Post Reply Page  12>
Author
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Topic: File being used by another process
    Posted: 23 September 2003 at 12:38pm

This is the error i get:

Server Error in '/' Application.

The process cannot access the file "c:\inetpub\wwwroot\counters\97658826122447124540.txt" because it is being used by another process.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file "c:\inetpub\wwwroot\counters\97658826122447124540.txt" because it is being used by another process.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:

[IOException: The process cannot access the file "c:\inetpub\wwwroot\counters\97658826122447124540.txt" because it is being used by another process.]
   System.IO.__Error.WinIOError(Int32 errorCode, String str) +614
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +888
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +44
   System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) +79
   System.IO.StreamReader..ctor(String path) +101
   System.IO.File.OpenText(String path) +30
   ASP.jscounter_aspx.page_load() +103
    System.Web.Util.ArglessEventHandlerDelegateProxy.Callback(Ob ject sender, EventArgs e) +10
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731


Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

it is only temporay, it only happpens after the txt file has been made by using file.create() is there anything i can do to stop this error?

Thanks Mart.

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2003 at 12:48pm

I am also getting this error:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 13: 	
Line 14:                dim sr as StreamReader = File.OpenText(server.mappath("counters\" & request.QueryString("SID") & ".txt"))
Line 15:                value = cint(sr.ReadLine().ToString())
Line 16:                sr.Close
Line 17: 			   

Source File: c:\inetpub\wwwroot\jscounter.aspx    Line: 15

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.jscounter_aspx.page_load() in c:\inetpub\wwwroot\jscounter.aspx:15
    System.Web.Util.ArglessEventHandlerDelegateProxy.Callback(Ob ject sender, EventArgs e) +10
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731


Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

Thanks, Mart.

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 23 September 2003 at 2:07pm

First, try

If Dir(server.mappath("counters/" & request.QueryString("SID") & ".txt")) = Request.QueryString("SID") & ".txt" Then

  Dim sReader As StreamReader = File.OpenText(server.mappath("counters/" & request.QueryString("SID") & ".txt"))

  Dim sValue As String = sReader.ReadLine()

  sReader.Close()

  Return True

Else

  Return False

End If

Now, this is in VB.NET, so no C#. If you really want C#, try and make this in C#, because it works in VB.NET like this.

BTW I colored it myself



Edited by Diep-Vriezer
Gone..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2003 at 12:41am
Thanks for that it works, but what was wrong with my code?
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2003 at 4:45am
Don't know, I've got some weird error's to that never occor, except when you need the script, so I rebuild the thing, and it might be something else, I don't really know. Maybe it is C#?
Gone..
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2003 at 4:46am
He, did you close the writer?
Gone..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2003 at 9:10am

Im not using C#! And i did close the writer.

mart.

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2003 at 9:44am
 Wh00ps, just a weird example from Microsoft how your pages SHOULD look like ... Well, why your code didn't work.. Maybe you had the textfile open in a reader or another proces (lol)? But anyway, if it works now, let's not worry to much.
Gone..
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.