We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Error Opening Excel Application in IIS7RSS

8 replies

Last post May 21, 2008 06:42 PM by Sirespi2

  • Error Opening Excel Application in IIS7

    Apr 21, 2007 01:11 PM|iokinpardo|LINK

    First, sorry about my english. I've a problem (it seems to be something very easy) with Opening Excel Application by ASP in IIS7. This code works fine in IIS6.


    Set objFSO = CreateObject("Scripting.FileSystemObject") 
    If objFSO.FileExists(Server.MapPath("/Today/File.xls")) then
      Set xl1 = CreateObject("Excel.Application")
      Set wb1 = xl1.Workbooks.Open(Server.MapPath("/Today/File.xls"))
      wb1.Close()
      xl1.Application.Quit()
      response.write "&load=ok"
    end if
     

    I know that the error is in the line [Set wb1 = xl1.Workbooks.Open(Server.MapPath("/Today/File.xls"))]The error that appears is the next:

    HTTP Error 500: Server internal Error. Description: There is a problem with the resource that it looks for and it is not possible to be shown.

  • Re: Error Opening Excel Application in IIS7

    Apr 22, 2007 01:08 AM|thomad|LINK

    Did you turn on the following setting?

    http://blogs.iis.net/thomad/archive/2007/02/06/security-is-painful.aspx

    Hope this helps.

    Thomas Deml
    Group Program Manager
    Internet Information Services
    Microsoft Corp.
  • Re: Error Opening Excel Application in IIS7

    Apr 22, 2007 09:09 AM|iokinpardo|LINK

    Yes. And I have "Excel" installed and all the Authentications and writing permissions correct. But I don´t know why is imposible to open Excel or Word applications with asp in IIS7.

    Set xl=CreateObject("Excel.Application") is not giving Error, but Set wb=xl.Workbooks.Open("File.xls") yes.

    This code works O.K. with IIS6.

    The error descriptions talks about Resources, but where are those resources? 

  • Re: Error Opening Excel Application in IIS7

    Apr 22, 2007 02:03 PM|thomad|LINK

    I can't get this to work either. I get the following error:

    Microsoft Office Excel error '800a03ec'

    Microsoft Office Excel cannot access the file 'D:\inetpub\wwwroot\test.xls'. There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook.

    /xl.asp, line 7

    What is the exact error you are getting and which Office version are you using?

     

     

    Thomas Deml
    Group Program Manager
    Internet Information Services
    Microsoft Corp.
  • Re: Error Opening Excel Application in IIS7

    Apr 22, 2007 02:48 PM|iokinpardo|LINK

    • The file name or path does not exist. It´s Correct.

    • The file is being used by another program. Excel is closed.

    • The workbook you are trying to save has the same name as a currently open workbook. Excel is closed.

    Exact error (Traslate from other Language): HTTP Error 500: Server internal Error. Description: There is a problem with the resource that it looks for and it is not possible to be shown.

    Office version: Office XP Professional, but with Office 2003 I got the same Error.

    SO: Windows Vista Home Premium

    This code works fine in IIS6. And is peculiar that IIS7 is not giving any Error with Set Xl=CreateObject("Excel.Application") and only when Opening.

    I don´t know if it would be something from "ApplicationHost.config" or "Web.config" files.

  • Re: Error Opening Excel Application in IIS7

    Apr 23, 2007 06:35 PM|iokinpardo|LINK

    <div class=ForumPostContentText id=ctl00_ctl01_bcr_ctl00___PostRepeater_ctl05_PostViewWrapper>

    Does anyone know why IIS7 don´t Find the needed Resource to execute the next code? What Resource is it, and where could I Find? It´s something about Excel Applications.

    set wb = xl.Workbooks.Open(Server.MapPath("/Today/File.xls"))

    This code works well in IIS6. And is peculiar that IIS7 is not giving any Error with Set Xl=CreateObject("Excel.Application") and only when Opening.

    Thanks to everybody.

    </div>
  • Re: Error Opening Excel Application in IIS7

    May 04, 2007 11:33 AM|iokinpardo|LINK

  • Re: Error Opening Excel Application in IIS7

    May 04, 2007 04:54 PM|tomkmvp|LINK

  • Re: Error Opening Excel Application in IIS7

    May 21, 2008 06:42 PM|Sirespi2|LINK

     

    Hello. It seems I have the same problem. Here is mi case:

    I have a web app that open an excel template, makes some calculations, and save it. After that, it gives the user the option to open or save it. The code is this: 

         Dim f As New Functions
           Dim ds As DataSet = f.EmpleadosEnActivo
           Dim dt As DataTable = ds.Tables(0)
           Dim oExcel As New Excel.Application
           Dim oBooks As Excel.Workbooks, oBook As Excel.Workbook
           Dim oSheets As Excel.Sheets, oSheet As Excel.Worksheet
           Dim oCells As Excel.Range
           Dim sFile As String, sTemplate As String
           sFile = Server.MapPath(Request.ApplicationPath) & "\Excels\MyTemplate.xlsx"
           sTemplate = Server.MapPath(Request.ApplicationPath) & "\Excels\MyTemplate1.xltx"
           oExcel.Visible = False
           oExcel.DisplayAlerts = False
           oBooks = oExcel.Workbooks
           oBooks.Open(Server.MapPath(Request.ApplicationPath) & "\Excels\MyTemplate1.xltx")
           oBook = oBooks.Item(1)
           oSheets = oBook.Worksheets
           oSheet = CType(oSheets.Item(1), Excel.Worksheet)
           oSheet.Name = "CALCULO EMPLEADOS"
           oCells = oSheet.Cells
           f.DumpData(dt, oCells)
           oSheet.Columns.AutoFit()
           oSheet.SaveAs(sFile)
           oExcel.Quit()
           ReleaseComObject(oCells)
           ReleaseComObject(oSheet)
           ReleaseComObject(oSheets)
           ReleaseComObject(oBook)
           ReleaseComObject(oBooks)
           ReleaseComObject(oExcel)
           oExcel = Nothing
           oBooks = Nothing
           oBook = Nothing
           oSheets = Nothing
           oSheet = Nothing
           oCells = Nothing
           System.GC.Collect()
           Response.Clear()
           Response.ContentType = "application/ms-excel"
           Response.AddHeader("Content-disposition", "attachment; filename=" & "RRHH.xlsx")
           Response.WriteFile(".\Excels\MyTemplate.xlsx")
           Response.Flush()
           Response.Close()

     

    The problem is that this works perfectly on mu XP machine under IIS 6. But when I put it in my Vista Ultimate machine with II 7, it doesnt work.... or quite. It onlly works if I execute the app from the Visual Studio IDE. Then it works perfect. But if I use the url http://127.0.0.1..... I get the messae that the file cant be accessed ( just when I am about to open it).  It says it could be due the file doesnt exist (obvisouly not the case), file already in use (not the case) an another on I cant remember, but I can ssure this is not the problem. I have been reading in some forums, doing things with the DCOM configuration for Excel, giving access to the file where the excel file us to some users, admin, network service account, etc. but no use

     

    I am desperate, does any one knows how to solve this?? I am sure this have to do with Vista adn IIS 7, it is obvious since this works perfectly for XP and IIS 6. I am alittle fed up of Vista.................