Vista, IIS7 and Classic ASP/Access

So, why am i writing this again? Because I believe the previous post was not so clear, and people were afraid to try it out!
So, i shall go slowly this time, and explain on every step, what the command does. If you are done with ASP and IIS installation, than you might want to skip the first part

Part 1 » Getting IIS with ASP
Insert your Vista disc, head to Control Panel > Programs and Features > Turn Windows features on or off (you’ll find in the right side bar of the Programs and Features windows). A dialog box will pop, find Internet Information Services > Application Development Features > ASP
Check it, and anything else you want like IIS’s FTP service, or other features and hit OK
Wait for it to install, than move on…

Part 2 » Porting your application
Copy your ASP application to the newly created wwwroot directory at C:\inetpub\wwwroot\
Make sure all the paths and URLs are alive, DSNs are set, and the database is where mentioned in the Jet connection string or DSN.
Fire up your browser and enter http://localhost/ in the address bar. If your application has a recordset pulling data from an Access database table, and you get the following error:

Microsoft JET Database Engine error ‘80004005′
Unspecified error

than IIS and ASP is working just fine, and it’s time you gave IIS read/write access to the temp directory where Access extracts itself when you use it with your ASP application. Open CMD with Administrative privileges and type these and hit Enter

%windir%\system32\inetsrv\appcmd set config /section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false
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)

In earlier versions of IIS, the worker processes used C:\windows\temp as their default temp directory, and not loading their own profiles for every thread created. This, however, has changed in IIS7 (though, it’s probably set to false by default in SP1 for Vista and Longhorn Server) and every process uses it’s own profile, and not using the default temp directory, thus messing up with the permissions. The first command turns the setting off, and the next two grant permissions to the temp directories, to allow read/write access so ASP can communicate smoothly with the Access database

Part 3 » Configuring script errors output
If your ASP script had an error, in IIS7, you won’t get the following

Microsoft VBScript compilation error '800a03ea'

Syntax error

/default.asp, line 4

Response.Write("I love classic ASP" && foo)
---------------------------------------------------^

but this

An error occurred on the server when processing the URL. Please contact the system administrator

This, is a security measure, taken by the IIS team, but you can always revert back to how the errors were shown in earlier versions of IIS and the way you like it! Open CMD once again with Administrative privileges and type this and hit Enter

%windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:true

You already know what this does… happy debugging! :)

Part 4 » Parents paths
Although this was already disabled in IIS6 (Windows Server 2003) but if you are coming from IIS 5.1 (Windows XP) or never used parent paths in IIS6, and use them in IIS7, you’ll be greeted with the following error

Active Server Pages error 'ASP 0131'

Disallowed Parent Path

/test.asp, line 1

The Include file '../bad.inc' cannot contain '..' to indicate the parent directory.

or this if you are using parent paths in your ADODB code

Server.MapPath() error 'ASP 0175 : 80004005'

Disallowed Path Characters

/testdir/test.asp, line 9

The '..' characters are not allowed in the Path parameter for the MapPath method.
[/sourcecode]
Using parent paths is very critical, atleast for me! And thus, I had to enable them, using the following command

%windir%\system32\inetsrv\appcmd set config -section:asp -enableParentPaths:true

That should fix you up!

Summary
What we did upstairs will enable you to run classic ASP applications with Microsoft Access databases like you used to run on your Windows XP's installation of IIS 5.1! Congratulations, and hopefully, this rewrite will help you. If something still doesn't work, just leave a comment here, and I'd surely help you! :)

Commands (again :P)

%windir%\system32\inetsrv\appcmd set config /section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false
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)
%windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:true
%windir%\system32\inetsrv\appcmd set config -section:asp -enableParentPaths:true

Sources (you might want to take a look at these): IIS Blogs post covering this | More about loadUserProfile (the thing that's causing trouble between ASP and Access database


About this entry