IIS 7.5, Classic ASP and Access database ….. Get It to Work After You Read This!!

I’ve been scouring the web(and pulling out my hair) for two days, and finally solve my problem, and finally get it to work. I thought I’ll share it with people out there who is still pulling their hair.

Ok. so I have some classic ASP pages that i want to migrate from IIS5 running windows 2000 to the coolest dandiest server OS from Microsoft. Here is the catch…. I’ve got some ASP pages that are still pulling out data from access database written in access 2000, and 2003. All of which are 32 bit version.

First thing first.

  1. MAKE SURE you configure your IIS right. You need to install a specific set of rules to enable classic ASP support. Read it Here.
  2. I don’t know about you, but I want my classic ASP to have its own Application Pool, separated from all my .NET stuff. So I created an application pool for all of my classic ASP page(of course you can create more than one if you want). This is what you need when you create an application pool(if you don’t know how to create application pool using IIS7, google it up).

    Name:
    Whatever you want.(I call mine Classic ASP)
    .NET Framework version: No Managed Code
    Managed pipeline mode: Classic.

    After you are done. Go to advanced setting of your Application Pool, and make sure the identity is set to ApplicationPoolIdentity. This is the default behavior for 2008 R2, but from my experience this past several days, I saw screen shot that is set to something else.

    If you’ve been researching, you’ll find out that a lot of people out there ask you to set the Enable 32-Bit Applications to True for you to enable the Jet Engine or the ODBC to interact with Access Database. In my experience, this is NOT necessary. I’m not saying that they are wrong.

  3. If your ASP pages is on a virtual directory(subdirectory within your root, NOT on your root directory), go ahead and convert that virtual directory to application(right click convert), AND select the application pool you just created in step 2 above.
  4. This is the most important thing. CREATE A HANDLER MAPPING for your *.asp page. I’ve read a lot of people complaining about getting 404 or 500 error because they did not set this up right. Double click on the virtual directory you just converted to application on step 3 above, and click handler Mappings. You need to add a SCRIPT MAP.

    This is where it gets tricky, and I do not find this mentioned anywhere but this blog, which I found really helpful. You need to decide first whether you want to run your ASP in 32 BIT or 64 BIT. A lot of posters out there tell you to enable 32 BIT setting in your application pool, but they did not tell you how to change the ASP handler to use the 32BIT version of the handler’s executable. I repeat, you do NOT need to set your application pool to enable 32bit.

    Add a script map using the following setting:

  5. Request Path: *.asp
    Executable: C:\Windows\system32\inetsrv\asp.dll
    Name: whatever you want. I named my Classic ASP

    The executable above is 64 BIT ASP handler for your asp script. If you want your ASP script to be handled in 32 bit environment, you need to use executable from this location: C:\Windows\SysWOW64\inetsrv\asp.dll.

    From my experience. if I use the 64bit version of the executable(as a lot of posters recommend), and set the application pool to enable 32BIT……. YOU WILL GET 404.17 error. Similar thing hapen(maybe different IIS error code) if you are using the 32 bit version, but do not enable the 32bit setting.


    In my opinion, if everything else works in 64 bit environment(which in my case it does), I don’t want to make anything run in 32bit unless i have to.The hardware and the OS is 64 bit. If the software can also run in 64 bit, why bother to change to 32? So, I use the 64bit executable.

  6. Test your configuration. Create a simple test.asp file in the virtual directory you just converted to Application in step 3 above, with just <%Response.Write(“test”)%> in it. See if it runs okay. It should. If it doesn’t, and it’s giving you error that complains about parent path, double click on the virtual directory you just converted to application in step 3 above, and double click on the ASP icon in features view. Set the enable parent path to true. While you are at it, under the debugging properties, set send error to browsers to TRUE, so you don’t have to hang yourself later trying to figure out what’s wrong with this world(or IIS). If you are using IE as your browser, make sure to turn off “Show friendly HTTP error messages” so that you can see the actual error(Internet Options, Advanced).

    At this point your ASP page should work fine. If not, make sure you do all the above steps right. If you are still getting an asp error, make sure you comment out “on error resume next” statement in your code. If the error message doesn’t help you, try to enable failed request tracing to understand what the error is about(google it up to find out how to set this up).

    Your ACCESS database is still crapping out at this point. You can hang yourself(like I almost did). OR…. if that’s not an option, do this….

  7. Install your Access database provider.Older access version uses JET.OLEDB 4.0 provider so that other application(such as ASP) can read and write data to it. This provider is 32BIT, and there is NO 64bit JET Engine. I repeat… NONE. I’ve seen suggestion that ask you to enable the 32bit support in your application pool, so you could get the JET engine to work. However I could never get this to work. HECK, the jet engine is not even registered on my server. I checked the registry entry, and there is no entry for for JET OLEDB provider. I don’t know how in some forum people get it to work, but I definitely can not get mine to work in IIS7.5 and 2008R2 environment.

    You do NOT need a Jet Engine. Even if you can get it to work……… DON’T use it. Microsoft never support Jet running under server 2008. Use Microsoft Access Database Engine 2010 Redistributable. This is a key to the magic kingdom(wherever that is). Download the 64 BIT version, and install it. Restart it after you install(most likely you don’t have to, but if you feel safer that way…. go ahead do it, and pull yourself together, don’t get up on that chair and hang yourself just yet).

  8. Change the connection string in your ASP page to
    “Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path to mdb/accdb file”
    example:
    connstr = “Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=” & server.mappath(“../..”) & “\databases\list.mdb”

  9. Buy yourself a case of Bud Light. At this point your ASP pages should be talking to your Access database and displaying on a web browser. If it is still not working…….. well, get that chair ready. I’m not sure what else could be the problem.

If I’m missing any step, please post a correction. Hope this helps someone

30 thoughts on “IIS 7.5, Classic ASP and Access database ….. Get It to Work After You Read This!!

  1. Yes… as Mathew said : This is the best post I have found on this issue
    AND : It has solved my issue completely.

    Thanks a lot man. It was simple, easy to read, easy to do, and it works.

    Thanks again

  2. Thank you! Saved me from hanging myself.
    Thank you for writing it in plain English without all kind of sidetracks that aren’t making anything clear. I am Dutch, so sometimes it’s hard for me to follow what someone means in there ‘manual’.
    Allthough I’m using a Dutch version of Windows Server 2012, it was no problem what so ever.
    Again, thank you!

  3. OMG……………THANK YOU FOR THIS POST!!! I HAVE BEEN GOING THROUGH EVERY DAMN SETTING TRYING TO CONFIGURE THIS STUPID THING, TO NO AVAIL. AFTER READING AND APPLYING THIS….IT WORKS! YOU’RE AWESOME!

  4. Thank you very very much for your post!
    You saved me for a lot of time of investigation. Doing just Enable 32-bit apps in Application Pool really does not work.
    Your solution is the best. I did’t have to change anything in my asp classic / access provider code.

    Thanks a lot!

  5. Regarding “Add a script map”,
    is there any way this could be programmatically done, e.g. using “appcmd.exe” or other command?

    I’ve tried this by running it wih:
    C:\windows\system32\inetsrv\appcmd.exe set config /section:handlers /+[name=’ASPClassic’,path=’*.asp’,verb=’*’,scriptProcessor=’%windir%\syswow64\inetsrv\asp.dll’,preCondition=’MyWebSite’]
    where “MyWebSite” is my classic ASP web.

    But that command adds for all Default Web Site, not for “MyWebSite” only.
    Thanks in advance.

  6. thanks for the help
    this got me most of the way
    few notes:
    seems sp1 of r2 added the handler mapping when it installs the role
    i used a system dsn and its working for reading but not writing i still have to dig into that
    thanks

  7. Great post! Thank you! A couple of steps there made all the difference. I am archiving this post! This solve almost all my problems. The only issue I am having is that I have a couple of clients’ sites with both classic ASP AND ASP.net. Those are not working because if I configure for classic ASP, ASP.Net stops working and vice-versa. Any suggestions? Right now I am running off two different servers because it worked in IIS6.

    Thank you.

  8. Website is using windows 2008 R2 with IIS 7.5

    I can able to get output value of cache header respond of html, jpg, png, but cache header is not responding for .aspx extension it is dynamic site with asp.net 4.0 framework.

    I required TTL value for cache header as we have configured this for 300 second time to live.

    Any help is much appreciated.

  9. Article is really helpful. Finding all related steps to follow on same place is a joy 🙂 Thank you

  10. hi i want to do my 4th year project using ASP.NET so i am new to the platform.i have tried installing the IIS components from control panel and turning off firewall but stil cant view the pages i create in the browser.i get this error message

    “Error Summary
    HTTP Error 404.0 – Not Found
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    i am not very technical so if ther is a solution can u giv it step by step.

  11. YES! This did it! Thank you so much! I’m using IIS 8 on Windows Server 2012 and successfully got my old ASP pages and Access database connections working using your guide. This type of connection string seems to be working as well: Conn.Open “Provider=Microsoft.ACE.OLEDB.12.0;Data Source=” & Server.MapPath(“db\databasename.accdb”)

  12. I almost reached for my chair. I set up the Classic ASP application pool like you recommended…but I neglected to use new application pool. Duh!

    Thanks for the help…and the added humor.

  13. I am experiencing what may be a simpler problem, not related to a database. I am running Win 7 and IIS7.5. I am attempting to get a Classic ASP page to run in IE 9, just a simple test program, as suggested above. I went through all the above steps up through creating the script map then created the test file. When I open it in IE, the actual content of the file is echoed to the browser, rather than just the string “test”. I’m new to ASP, IIS, web servers, server side scripting, etc. So perhaps I did not set something up correctly along the way. (Is it possible I have *too many* features turned on in IIS, i.e. some that should not be on for classic ASP to fly? I think *all* IIS features are on.)

    I have been poking around online all day, looking at various peoples’ suggestions on how to get class ASP to run on IIS 7.5 in Win 7. And so I *think* I have it all set up correctly. But what the heck do I know? 🙂 Any help is much appreciated.

    Best,
    David

    1. Did you put after code. I did this absent minded and all my code was displayed on the browser. Now if you can tell me how to find server manager on IIS7.5 in Windows 7, I would be happy as I am unable to connect to database without permission and authorization. All these gurus tell me to use server manager to add roles but there is no server manager.

  14. Thank you for this post, the information was comprehensive but more importantly it worked.

    I cannot tell you how long this has been a problem for me. You have made me very happy and saved me a huge amount of work.

  15. I just discovered your website and it seems to be the most comprehensive by far dealing with Access, IIS 7.5 and Server 2008 R2. I have – I think – followed all the instructions, but I cannot connect to my trivial test database. Here is what I have done so far:
    * My server is a virtual Server 2008 R2, 64 bit
    * I created a Classic ASP application pool as per your instructions
    * Enable 32 Bit Apps in my Asp Classic App pool is false
    * The Script Map points to the 64 bit asp.dll
    * I have Installed Access Database Engine 2010 64 bit using /passive, sine Acccess 2007 32 bit was already installed
    * IUSR and Anonymous login permissions are set both on the website and the database folder
    * The website is set up as a new site, not a virtual folder/application
    * ASP works
    * ADO works in that I can create a Connection object and set and read the Connection String property
    * I CAN NOT CONNECT TO THE TEST ACCESS DATABASE. I get error 501
    * I have also tried all of the above in 32 bit (asp.dll, Access Database Engine 2008 32 bit)
    * I have tried both the ODBC driver and the ACE OLEDB 12.0 driver.

    I am truly, truly stuck. Can anyone help

    – IVAR

    1. error 501 means you aren’t configuring the IIS right. Sorry about my stupid response 🙂 but without looking at the server i wouldn’t know.
      if i may suggest, don’t start building database backed website using Access Database. I was stuck with an existing DB which I inherited back then. The Access DB I was talking about in my blog has now been converted to SQL server.

      it’s just a bad idea from the start to build a website backed by Access DB. Get MySQL or SQL Server Express. That would make your life A LOT A LOT easier. I promise.

  16. What finally worked for me:
    Under authentication, make sure ASP.NET Impersonation has a user that can set with access to the database.

  17. For all people running Microsoft Office 32 bit this does require a change to 64 bit MS Office. Because you can’t install Access 64 bit driver unless doing that. Microsoft recommends us to use 32 bits Office not to get problems with other applications.

    So I will have to try the 32 bit solution – if there is any!

    /Hans

  18. Good information, but mine still is not running, but I can’t follow your instructions exactly. My computer will not allow me to install the 64 bit drivers because I have some office files running in 32. The problem, one of those files is the Single Image file. If I remove that (by going into the registry) I am afraid I will lose the ability to use any of my MS Office programs. Right or Wrong? For that same reason I also had to install ACCESS 32bit instead of 64 bit. ASP runs but when I add an ACCESS connection I get a server error. The file works on my online server just not on IIS. (I hope I didn’t double post this. My MIFI is acting up so I don’t think the previous try worked.)

  19. Good information, but mine still is not running, but I can’t follow your instructions exactly. My computer will not allow me to install the 64 bit drivers because I have some office files running in 32. The problem, one of those files is the Single Image file. If I remove that (by going into the registry) I am afraid I will lose the ability to use any of my MS Office programs. Right or Wrong? For that same reason I also had to install ACCESS 32bit instead of 64 bit. ASP runs but when I add an ACCESS connection I get a server error. The file works on my online server just not on IIS

  20. Finally… a straight up article on this issue. This just extended a simple app’s lifespan…

    Thanks

  21. Tried for days to get this work, this is the first post that actually allowed me to fix the problem! Thanks much!

  22. Hmm Matt,
    I’m not 100% sure, but this is my two cents. In your case, I believe your vendor need to come up with a new ODBC driver that supports running in 64 bit environment. this is just like microsoft needed to create a new driver to work with Access DB.

    If i were you, i would try tackling the problem one at a time.

    In theory, you can still run 32 BIT app in 64 bit environment, but in practice that’s a whole different story. So try the following first:

    1. use a 32BIT ASP handler in IIS like i mentioned in my blog, and try running a simple ASP script with just Response.Write statement.
    Get this to work first. If this does work, then you start playing with the ODBC driver. A lot of XP(similar codebase with windows 2003)application needs to be re-written in order to run in Windows7(similar codebase with Windows 2008). I believe your ODBC driver is probably the same way.

    2. I know that you can NOT mix and match. If you run a 64BIT asp handler, your ODBC driver can’t be 32 BIT. You also need to make sure that you are running 32 BIT ODBC. if you go to admin tools in windows 2008, that ODBC IS 64 BIT ODBC. If your driver is a 32 bit driver, IT WILL FAIL!. The 32 bit odbc is called Odbcad32.exe and is located under %systemdrive%\Windows\SysWoW64

    I don’t know how much of a help this can be, but good luck. I don’t have a wrox account, so i’m just posting a reply here.

  23. Hi there – This is the best post I have found on this issue however it has not solved my issue which is exactly this but relating to a 32bit driver from an Australian financial software firm My Own Business (MYOB). Its a classic ASP application which just reads data using a system DSN which I have created for an ODBC connection to the MYOB software.

    I am a member of the Wrox p2p community and contribute to the classic ASP area allot. Is there any chnace you can have a look at my post and give me your advice/help? My post is located on p2p.wrox here:

    http://p2p.wrox.com/classic-asp-professional/81437-iis-7-5-running-32-bit-applications.html#post265110

    Thank you for your time
    Matt from Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*