resolve error for Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046}

1

I want to open server excel as a workbook in client machine but i am not able to open it, but with same code it is working perfectly on local machine.

My c# code is as under

string physicalFileName1 = "";

hfDrive.Value = ConfigurationManager.AppSettings["Patientuplao"].ToString();

string filename = txtfile1.Text;
physicalFileName1 = hfDrive.Value + "\\" + filename + "\\PatientChart.xls";
if (txtfile1.Text != "")
{
    try
    {
        physicalFileName1 = hfDrive.Value + "\\" + filename + "\\PatientChart.xls";
        var excelapp = new Microsoft.Office.Interop.Excel.Application();
        excelapp.Visible = true;
        Microsoft.Office.Interop.Excel.Workbooks wbook = excelapp.Workbooks;
        Microsoft.Office.Interop.Excel.Workbook sheet = wbook.Open(physicalFileName1);
    }
    catch (Exception ex)
    {
        txtMessage.Text = ex.Message.ToString();
    }
}

after this implementation i got this error

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

c#
asp.net
asked on Stack Overflow Oct 21, 2019 by user3575139 • edited Oct 21, 2019 by CaringDev

1 Answer

0

it seems that the user that is running the website (you are using asp.net) doesn't have the permission on the desired workbook. Try to change the permissions on the workbook on the server and add the user that is running the website.

answered on Stack Overflow Oct 21, 2019 by CyberZeus

User contributions licensed under CC BY-SA 3.0