locked
Site that Worked Is Now Bombing and No Code Changed RRS feed

  • Question

  • User-748031297 posted

    Visual Web Developer 2008 Express.  Visual Basic. IIS 6.0.

    I am using the Excel library (Imports MSExcel = Microsoft.Office.Interop.Excel) to create some Excel workbooks in my code behind.  This code has been working fine for a year.  Now users are getting errors when it tries to run.  However, I do not get an error when I run the same code (I am logged into the site as an administrator using Windows authentication).  The only thing that has changed is that I installed a couple programs, unrelated to this web site, and I created another web site (separate from this web site) in IIS 6.0.  My C: drive was thus reduced to 2 GB of free space.  I have worked to bring it back to 7.11GB of free space.  I do not understand the error.  The error that is thrown is:

     

    Server Error in '/' Application.

    Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space.

    • To make more memory available, close workbooks or programs you no longer need.

    • To free disk space, delete files you no longer need from the disk you are saving to.

    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.Runtime.InteropServices.COMException: Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space.

    • To make more memory available, close workbooks or programs you no longer need.

    • To free disk space, delete files you no longer need from the disk you are saving to.

    Source Error:

    Line 479:        xlApp.SheetsInNewWorkbook = 1
    Line 480:        'xlWorkBook = xlApp.Workbooks.Add(misValue)
    Line 481:        xlWorkBook = xlApp.Workbooks.Add(1)
    Line 482:        xlWorkSheet = xlWorkBook.Sheets(1)
    Line 483:        If RepType <> "LYBUNT" Then

    Tuesday, March 30, 2010 11:56 PM

All replies

  • User-1659704165 posted

    There may Be Chnaces That Data Which You are trying above 4 MB.. Try Write or Export Data Less Then 2 MB and Then CHk..

    OR

    Better Modify The code for OpenXML

    http://blogs.msdn.com/brian_jones/archive/2008/11/04/document-assembly-solution-for-spreadsheetml.aspx

    http://msdn.microsoft.com/en-us/library/aa276847%28SQL.80%29.aspx

    the Above link for More Info


    Wednesday, March 31, 2010 7:34 AM
  • User-748031297 posted

    It is not a disk space issue as I freed up 15GB of space on the drive and the error still occurred.  Something else has changed (perhaps when I installed the other web site) although I do not recall changing any permissions.  I have read elsewhere that this may be a permissions issue.  Any ideas?

    Wednesday, March 31, 2010 8:15 AM
  • User-37275327 posted

    Have you enabled disk quota? Better check on your partition.

    Wednesday, March 31, 2010 8:20 AM
  • User-748031297 posted

     How do I check if I have disk quota enabled on my partition?

    Wednesday, March 31, 2010 10:25 AM
  • User-748031297 posted

     I replaced the microsoft.office.interop stuff with:

    1. Download the NPOI Release Binary, and unzip the zip file

    2. Copy all the files (except ICSharpCode.SharpZipLib.dll) into the Bin directory of your website 

    3. Place this import statements:

    Imports System.IO Imports NPOI.HSSF.UserModel Imports NPOI.HPSF Imports NPOI.HSSF.Util Imports NPOI.POIFS.FileSystem
    4. and an example:
        Public Sub CreateAndDownloadXls(ByVal filename As String)
            'Create workbook
            Dim workbook = New HSSFWorkbook()
            'Create Sheets
            Dim sheet1 As HSSFSheet = workbook.CreateSheet("Sheet1")
            Dim sheet2 As HSSFSheet = workbook.CreateSheet("Sheet2")
    
            'Select Cell A1 on sheet1 and set value to "Hello World"
            Dim RowNumber As Integer = 0 'RowNumber is zero based
            Dim Column As Integer = 0 'Column is zero based
            sheet1.CreateRow(RowNumber).CreateCell(Column).SetCellValue("Hello World")
    
            'Merge Cells on sheet2, A2 (0,1) to C4 (2,3)
            Dim region As New Region(0, 1, 2, 3)
            sheet2.AddMergedRegion(region)
            'Select the merged region with the top left cell (0,1)
            sheet2.CreateRow(0).CreateCell(1).SetCellValue("merged cells")
            'Create XLS file in memory
    
            Dim file As New MemoryStream()
            workbook.Write(file)
            'Stream file to browser
            Response.ContentType = "application/vnd.ms-excel"
            Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", filename))
            Response.Clear()
            Response.BinaryWrite(file.GetBuffer())
            Response.End()
        End Sub
    
     
    

     


     

    Wednesday, March 31, 2010 7:20 PM
  • User-37275327 posted

    Right click on the drive and then you can see the disk Quota tab.  

    Thursday, April 1, 2010 2:23 AM