Vra

Ek het dus 'n funksie:

   public static void ProcessWorkSheet(string fileName, string month, string year,
     string thread)
    {
        //version number location
        int version_row = 10;
        int version_column = 2;

        SeedsDBEntities db = new SeedsDBEntities();

        try
        {
            //Instance of Excel
            ExcelApp = new Microsoft.Office.Interop.Excel.Application();

            ExcelApp.Visible = true;

            ExcelApp.DisplayAlerts = false;

            WorkBook = ExcelApp.Workbooks.Open(@fileName, 0, false, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
            (Microsoft.Office.Interop.Excel.Worksheet)WorkBook.Worksheets.get_Item(month);
                    .
                    .

            //the rest of the code
     }

Ek gebruik Microsoft.interop -biblioteek om van 'n Excel -blad te lees en dit in 'n databasis te stoor. Die probleem hier is dat ek 'n "Object Reference Not Set op 'n voorbeeld van 'n voorwerp" kry wanneer die kode die werkboek op IIS 8 probeer open. Dit werk goed op Visual Studio 2010. Wat kan die probleem wees.

Was dit nuttig?

Oplossing

Ek moes IIS -gebruikers toestemming gee om die toepassing te gebruik. Skep 'n vouer C: Windows SYSWOW64 Config SystemProfile Desktop vir 64-bits-stelsels en stel die toestemmingsinstellings in om IIS-gebruiker moontlik te maak.

Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top