Using Access Database on IIS7

Although PHP is a very much preferred programming language on the web now, especially on open source applications, but we must not forget Microsoft IIS. I was doing a web project for a client when I realized their server is running on Microsoft Windows and obviously their application server is running on IIS. I had no choice but to adhere to their requirements and develop the project in ASP and Microsoft Access. Yes, they are a perfect match for small to medium sized applications.

Now, my local computer is running Windows Vista with IIS7. Running classic ASP applications on this setup is not as smooth sailing as it used to be when we were using Windows XP or Windows 2000… I just hate the new security that were introduced in newer version of Windows.

There are a few changes in IIS7 which Classic ASP developers should be aware of… but one of them which has been bugging me for a while is the dreaded:

Microsoft JET Database Engine error ‘80004005’
Unspecified error

message thrown when my ASP script tried to read and write to the Access database. Stupid ACL security on Windows Vista.

How do you fix this problem?

The answer is obviously with the ACL… The following commands will grant the Network Service temp directory to allow creator write and read privileges.

icacls %windir%\serviceprofiles\networkservice\AppData\Local\Temp /grant Users:(CI)(S,WD,AD,X)

icacls %windir%\serviceprofiles\networkservice\AppData\Local\Temp /grant “CREATOR OWNER”:(OI)(CI)(IO)(F)

Command prompt

How do you run the above commands? Go to a DOS prompt with Administrator privileges, and run them. If the above still failed to work, run the following line too.

%windir%\system32\inetsrv\appcmd set config /section:applicationPools /[name=’DefaultAppPool’].processModel.loadUserProfile:false

No, I didn’t invent these lines, it was the awesome work of these people. Read to understand more on loadUserProfile, IIS7 and temporary directory failures. Hope this makes your ASP coding a little bit easier. 🙂