Results 1 to 6 of 6

Thread: Run exporting as windows service

  1. #1

    Thread Starter
    Addicted Member t3cho's Avatar
    Join Date
    Mar 2014
    Posts
    234

    Run exporting as windows service

    Using windows service to run Console application which will generate Excel and convert it to pdf.

    When i run that console application manually it works like a charm but when windows service start it it does pop up error

    Not enough storage is available to complete this operation. (Exception from HRESULT: 0x8007000E (E_OUTOFMEMORY))
    Windows service to start console app is using code shown bellow
    Code:
    Private Sub ProcessStart(path As String)
            Dim proc As New Process
    
            proc.StartInfo.UseShellExecute = False
            proc.StartInfo.CreateNoWindow = True
            proc.StartInfo.ErrorDialog = False
    
            proc.StartInfo.RedirectStandardOutput = True
            proc.StartInfo.FileName = path
    
            proc.Start()
    
            proc.WaitForExit()
            Dim output As String = proc.StandardOutput.ReadToEnd()
    
        End Sub
    Console application use code above to generate the pdf file

    Code:
    workbook.ExportAsFixedFormat(Excel.XlFixedFormatType.xlTypePDF, myCfg.ExportPath & "\" & fileName & ".pdf", Excel.XlFixedFormatQuality.xlQualityStandard)
    And that was the line which throw mentioned error.

    What i have tried

    Tried to set Interactive user in window compnents on excel

    Result : Error
    Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

  3. #3

    Thread Starter
    Addicted Member t3cho's Avatar
    Join Date
    Mar 2014
    Posts
    234

    Re: Run exporting as windows service

    JDC2000 i already tried all of that but nothing.

    I dont see a problem with hardware configuration since it works like a charm with manually run.

  4. #4

    Thread Starter
    Addicted Member t3cho's Avatar
    Join Date
    Mar 2014
    Posts
    234

    Re: Run exporting as windows service

    Ok do we have other free solution for converting file from excel to pdf.

    I need the simplest solution to convert file xls from path A to pdf on path B

    Was googled for a solution online but most of solutions are paid to use. Possibly the best solution would be to get code snippet

    Tried with :
    Spire, iText ...

  5. #5
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Run exporting as windows service

    If it works when run manually, why not just make a batch file and a scheduled item in Task Scheduler to run it?

  6. #6

    Thread Starter
    Addicted Member t3cho's Avatar
    Join Date
    Mar 2014
    Posts
    234

    Re: Run exporting as windows service

    Since it is not posible to export directly from windkws service i made console app which will do that. So windows service only runs it. Windows service is checking user defined configuration and run the console app depending on that. I only can try to execute batch file which will run console app. Dear god

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width