There is not enough space on the disk.

Discussion in 'ASP.NET / ASP.NET Core' started by Razor, Jan 30, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi there,

    I seem to have stumbled on a problem and was hoping that someone may be able to help me out as I'm currently banging my head against a brick wall here.

    If I attempt to write a file above (approx) 720 bytes using the StreamWriter class I get thebelow exception (please see suffixappended to message). Currently I have 750MB, 33MB of which is used. The account I am using has 550MB but for good measure I have also given anonymous full read/write access to the directory just in case its losing its logged in user information (which I'm fairly sure it is not anyway).

    Here is an example script that causes the below problem:




    StreamWriter swFile=new StreamWriter(Server.MapPath("\\Products\\MenuStructure\\ProdMenu.XML"),false);


    for (int a=0 ; a<59; a++)


    swFile.WriteLine("1234567890");


    swFile.Close()





    The above will create a file 720 bytes long no problem. However, if I was to increase the iterationby one value higher (ie a<60) theweb app will then bomb. Is this some problem with the discountasp.net servers or should I be writing files in a different way?


    Any help in this matter would be very much appreciated. :)


    Best regards,


    Mark Barnes



    There is not enough space on the disk.


    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: There is not enough space on the disk.

    Source Error:





    Code:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace:





    Code:
    [IOException: There is not enough space on the disk.
    ]
       System.IO.__Error.WinIOError(Int32 errorCode, String str) +723
       System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) +134
       System.IO.FileStream.FlushWrite() +55
       System.IO.FileStream.Flush() +39
       System.IO.FileStream.Dispose(Boolean disposing) +55
       System.IO.FileStream.Close() +17
       System.IO.StreamWriter.Dispose(Boolean disposing) +291
       System.IO.StreamWriter.Close() +9
       products.category.GenerateXMLMenu() +96
       products.category.butGenerateXML_Click(Object sender, EventArgs e) +17
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain() +1292
    
     
  2. I think it depends on how you are doing the authentication. I havent played much with different users uploading files, but how are you performing the authentication?


    Joel Thoms

    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. Bruce

    Bruce DiscountASP.NET Staff

  4. Is it a security risk to give these Anonymous users disk Space?
    I'ld like to be able to write errors to a Log file but I've had the
    same problem with not having enough space. Instead I've been
    emailing myself all of the error messages (Not that there's a lot)
     
  5. Basically the area that performs the operation can not be accessed by anonymous users (Anonymous - READ (DENY) WRITE (DENY)), so therefore when you attempt to access that particular web page you must specify a valid username and password. The area this application writes to can only be read by anonymous users, again they have no access to write. However, when attempting to write to this location - if it attempts to write more than 720 bytes we encounter the above exception but if we assign space to the above anonymous user accounts (maybe I should remove the disk quota for one of the above accounts to see which account actually needs the disk quota) the application writes fine. So, the application seems to write in the security context of the user who is logged in (othwise it would not be able to write at all as it has no permission to do so)but it seems that its ability to write is also impacted by the disk quota assigned to one of those anonymous user accounts.

    Best Regards,

    Mark Barnes
     
  6. I dont think it is a security risk toassign Anonymous users a disk quota as long as you dont give them any write access to your directory structure.. [​IMG] [​IMG]

    Post Edited (Razor) : 1/31/2006 9:49:40 PM GMT
     
  7. Well razor, you are doing the authentication correctly. I would have assumed what you have written would have forced the file writes to be under a specific users quota, but it appears they are still being written by aspnet user.

    I'm assuming this is the way asp.net was designed to work and you may have to force it to write under their quota by using impersonation.

    Though I'm just guessing here, as I have not done any file writing with non-anonymous users myself.


    Joel Thoms

    DiscountASP.NET
    http://www.DiscountASP.NET
     
  8. Yes it does seem very odd, it writes under the security context of the logged in user (as it fails if I specify a test user account that has no 'WRITE' rights to that directory) but it seems to borrow the disk quota information from the anonymous user account. Very odd, and not a major problem as its only used by an admin to auto generate an XML menu file when we update the database. .. And now I know a workaround to get me past the problem so its all good. :)

    Thanks for your help gents, very much appreciated. :)

    Best regards,

    Mark
     
  9. 10 minutes later..

    Ok solved the problem by giving the following users some disk space:





    Anonymous ASPNet User
    ******
    1 MB
    20 MB
    Edit


    Anonymous User (IUSR)
    ******
    0 MB
    20 MB
    Edit

    Now this isnt right because it should be running in the context of the user that I specified when connecting to the restricted directory - whats going on?

    Best regards,

    Mark
     
  10. If I'm writing a 100KB file to
    30 directories in my application
    then how big should I make my
    Anonymous User (IUSR) quota?
     
  11. Er.. 3MB?

    Is this a trick question? [​IMG] [​IMG]
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page