The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

I am working on my local machine. I setup a web application in vs 2010 and read an excel spreadsheet via oledb like so:

 var sConnectionString = "Provider =Microsoft.ACE.OLEDB.12.0;" +
"Data Source=" + HttpContext.Current.Server.MapPath("Return Addresses.xlsx") + ";" +
"Extended Properties =\"Excel 12.0 Xml;HDR=YES;\"";

        // Create connection object by using the preceding connection string.
        var objConn = new OleDbConnection(sConnectionString);

        // Open connection with the database.

It worked flawlessly. I setup a website (not application) in vs2010 running on localhost. I run the exact same code and get the following error when i run objConn.Open();:

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Im using the same machine, I have office 2010 32-bit version installed (my machine is a 64-bit). I have downloaded and ran AccessDatabaseEngine.exe downloaded from this site, but that didnt work either. Why can I  read an excel spreadsheet via oledb when I create a web application, but cant read it when I create a website?

Who is Participating?
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello, you can try these two options:
1. Try installing the 64bit version of Microsoft Access Database Engine components, here the link (is different from yours):

2. If you are running your web site on your local IIS, probably your application pool where your aspnet application is running don't has enabled the option to allow 32bit applications, you can set that in your application pool advanced settings (IIS7), enabling it will allow to use the 32bit Microsoft.ACE.OLEDB.12.0 provider:
Application Pool Advanced Settings - IIS7
I recommend you to try the option 1 first.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.