Running legacy asp scripts on Vista and IIS 7.0

2006-11-24
Getting my legacy asp scripts to run against a Microsoft Access database on Windows Vista and IIS 7.0 took some investigation.

Using Process Monitor was an enormous help when I had no clues but:

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

Hey, that’s me! And then:

Microsoft JET Database Engine error ‘80004005’
Unspecified error
/myapp/myscript.asp, line 9

Ok, so I suspected that the first problem was due to the fact that I needed to activate asp scripts in some way. However, turns out it was a new setting for sending the error message to the client (maybe it has existed somewhere before, but I’ve never had to change it). This setting is located in the new IIS Manager:

Features View, ASP, Debugging Properties, Send Errors to Browser

But this only got me to the second error message. And that, I had seen before. It should have something to do with file and directory permissions. Being uncertain about which user IIS 7 actually runs legacy asp scripts as, I used Process Monitor to find the “IUSR” user. But givning that user full permissons to the directory where my.mdb resided didn’t help. So back to Process Monitor – filtering on failed operations from the w3wp.exe process. Ahh! Temporary files. Of course! The OLEDB driver needs access to the system temporary folder to store some files when opening the connection to the database file. And the location for this in Vista is:

C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp

Now, UAC can really drive you mad. I wonder how long I can take it before giving up and turning it off. For security purposes, it is of course great. Then again, I’ve run Windows for a lot of years as a member of the Administrators group, and never had any real security issues. At least not any that I know of… 🙂

Pasting “C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp” into the address bar of Explorer will tell you that it doesn’t exist. Well, I didn’t believe Vista so I removed the ending directories until Vista told me that I had to elevate priviliges to get into one of the parent folders. Ok, I did that and now I could get into the full path. Great. A warning that I was changing file permissons on a system directory was all that was standing between me and success – and thankfully that was not an obstacle.

So now I’m running my old asp-scripts until I’ve had the opportunity to convert all projects to asp.net.

42 Responses to “Running legacy asp scripts on Vista and IIS 7.0”

  1. Soheil Malek says:

    I had same problem and solved completely, Thanks.

  2. Tim Digital says:

    Excellent stuff Mike,

    I came across the actual support article relating to this on Microsoft’s site – so thought this was the best place to share it – as I originally used your solution.

    http://support.microsoft.com/kb/926939

    Thanks.

  3. Ian Haynes says:

    I’ve been though the same scenario and the details above and in the MS article helped me to get asp pages reading data from an Access db. However I can’t get writes to the db to work. They give the ‘operation must use an updatable query’ error. I’ve checked permissions and they are all OK.

    What else should I be looking at?

    Any thoughts appreciated

  4. mikeplate says:

    [Ian:] It sure sounds like a permission problem. If all possible users have full rights, you might still like to write an asp-script that just creates a new text file in the same folder as the mdb-file is located. Run it and check out its result. By the way, I’ve used this method followed by checking who the owner of this file is, to be sure as to which user the asp-scripts actually are running as (if impersonation gets you confused). Also, it is not as simple as the read-only attribute on the mdb-file?

  5. Ian Haynes says:

    Mike, It seemd like all the permissions were correct, IUSR, administrator, user etc. I then did an install of Vista + IIS7 on my laptop and went through the same process doing so, but this time reads and writes to the Access db worked. Looking at security I found an account ‘Authorised Users’ which wasn’t on the desktop settings. Having added this account to the desktop, the writes now work there too. I would have expected the IUSR settings to be the controlling factor. ?? Anyway problem solved. Your response appreciated.

  6. Steven Clark says:

    Fantastic Mike

    Thanks for posting this because it was driving me mad. I did try the microsoft solution first however it did not resolve my problem, but your did.

    Thanks again

  7. HURRAH !! says:

    Unbelievable !! Did we forget to mention that we had to convert the asp pages into an APPLICATION !! 🙂 *phew* After it drove me through wall a few times.. we have it working now !! and thanks for the thread Mike !!

  8. Tom Blake says:

    YOU ARE MY HERO!
    I trawled the internet for hours for a solution to this, the got here! Thanks very much for the information – VERY helpful!

  9. Running Classic ASP Pages on IIS 7.0 in Windows Vista

  10. Jakob Okmian says:

    THANK YOU!
    This wasn’t easy to solve, but thanks to your article i finally made it!

  11. FragglePete says:

    Mike…. You’re a star. Scratching my head for a while, but now all my Dreamweaver sites that access a MS Database now work again.

    Cheers!

  12. Kong says:

    Hi Mike… I have the same problems and tried your method but it still does not work. I can view the temp folder on my laptop, and have set the IUSR_ “modify” permission to it.. or do i have to set a different permission? Pls help!

  13. gr0x0rd says:

    Good style Mike!

    This almost got me there- I ran the commands as an admin to allow write access for the User account to the C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp folder but it still didn’t work until I added the account to the security permissions manually. Anyone who doesnt have success running the commands should be able to get up and running this way.

    ~g

  14. justin says:

    Hey,

    Thanks for posting this. I too had this problem and searched the internet like crazy. All the old versions of Windows had the classic “Documents and Settings/UserNameHere/AppData/Temp” folders and I kept modifying those like crazy and had no result. Thank you SO much for this post. I didn’t know there was another AppData/Temp in the freaking Windows directory…wow. Seriously, THANKS!

  15. Ian says:

    Hi,

    many thanks for this post. I was bogged down in C:\Windows\temp and getting nowhere and on the verge on uninstalling Vista. Nice one.

  16. @rfah says:

    Hi,
    i am the new user that using the vista.i want to used the odbc.but cannot find the file.after i follow ur suggestion.but its doesnt work.help me plz…i need to submitt my assignmnt…and 1 more thing,how to add the account to the security permissions manually? tQ.

  17. beto says:

    Ok amigo parabens funcionou perfeitamente

    valew abraços

  18. Marcus says:

    Thanks so much! I don’t use ASP much these days and so when I dusted off an old site, you saved me a headache 🙂

  19. Rob says:

    Hi, can you break down the last part, I have been going nuts over this but if you would be able to break the part at the end down a bit for us idiots that would be great. This part:

    Of course! The OLEDB driver needs access to the system temporary folder to store some files when opening the connection to the database file. And the location for this in Vista is:

    C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp

    Now, UAC can really drive you mad. I wonder how long I can take it before giving up and turning it off. For security purposes, it is of course great. Then again, I’ve run Windows for a lot of years as a member of the Administrators group, and never had any real security issues. At least not any that I know of…

    Pasting “C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp” into the address bar of Explorer will tell you that it doesn’t exist. Well, I didn’t believe Vista so I removed the ending directories until Vista told me that I had to elevate priviliges to get into one of the parent folders. Ok, I did that and now I could get into the full path. Great. A warning that I was changing file permissons on a system directory was all that was standing between me and success – and thankfully that was not an obstacle.

    I got the first part working, thanks. At least now I know what the error is. If you could please, please help with this that would be fantastic. Thanks a million you are a true genius.

  20. mikeplate says:

    Rob solved the problem by using this excellent information:

    http://blogs.iis.net/bills/archive/2007/05/21/tips-for-classic-asp-developers-on-iis7.aspx

    There seems to be a command you can run in order to set the permissions correctly (no need to find the folder manually).

  21. Peter says:

    Thank you so much Mike! I’ve spend countless hours wondering why my ASP pages that worked in XP on IIS 6.0 suddenly stopped working when I upgraded to Vista. I’ve scoured dozens of websites offering suggestions, mostly related to permissions, but yours is the first one to highlight the exact problem. So again, my brain and I thank you!

  22. hellosuny says:

    Amazing.. No Words to THANK YOU MIKE…
    All articles in MS site or Bla Bla forums FAILED. Without any faith and totally desperate, I assigned permissions to the InDepth TEMP Folder.. then without any hope, I refreshed the page.. and WHOOPS….. I got the insertion through… IT WORKED..
    I am thankful to Mike.. I wasted more than 7 hours on this issue… and you saved my numerous hours that would have been wasted in other sites.

  23. david says:

    Thank you very very much. I spend hours and hours trying to solve this darn problem. Your solution works. My ASP page works now. Thank you again.

  24. Oistros says:

    Ok, can someone please explain why we needed Mike to let us run our simple beautiful applications in Vista? People who develeoped Vista didn’t think that someone might need to work on a classic ASP application? All articles on the Microsoft site didn’t solve the problem until i found Mike.
    Common logic is something very rare in our times…

  25. Oistros says:

    I need to add also that
    MIKE=GOD

    I was ready to throw my VAIO outside the window…

  26. Peter De Rop says:

    Interesting information, I will surely need it, but first, I’m trying to get ASP to install on my machine.. IIS 7.0 installs fine, ASP.NET installs after some tweaking (removing ASP.NET from the ISAPI filters) but ASP keeps failing on install.. even when I deactivate UAC. It just says : some errors occured during install and one button : OK. After that, ASP is unchecked again, and I’m back to square 1. Any suggestions ?

  27. John (Kent, UK) says:

    Exact same problem, fixed in a jiffy, thanks very much

  28. Sebastian says:

    This is a great article and fixed all the issues I had. Did you know it is so hard to get a fix to this. A lot of people out there are so off.

  29. bigric says:

    thanks Mike.
    was ready to give up on editing my old client sites and switch to php and rewrite them there.
    you saved me a lot of effort and time.
    microsoft really doesn’t want scripted languages anymore!
    cheers

  30. kyle says:

    THANK YOU. I’m not a wordy guy but you just solved my problem of not being able to run an old asp app on my Vista box.

  31. Fred says:

    Thanks….. You saved me a lot of hair pulling…

  32. Phil says:

    Thank you so much – Setting up IIS 7 to work with Vista has been such daunting task – Sometimes I think Microsoft pushes the limits of the developer and consumer when it comes to their products – They are not clear at all in the explanations needed to actually get their stuff to work – Sometimes I truly feel that the consumers and developers of the world which use Microsoft products are the true QA Department, the true testers of the products and then just summit error reports which sit in a room the size of iron mountain to be applied to a Service Patch bug fix – MIKE you are truly great – I can appreciate people like you who take the time out to endure the PAIN of trying to get things working and to be able to explain it in a simple and easy to understand format – TAKE NOTE Microsoft –

  33. Scott says:

    Mike,

    I tried all of your suggested changes and I still cannot get my ASP pages to work right under Vista/IIS 7. I have a written a simple page that queries a table in SQL Server 2000 and just returns the contents. It works fine under XP. I have added the IUSR rights to the temp folder as you indicated. I still get “Microsoft OLE DB Provider for SQL Server error ‘80040e4d’

    Login failed for user ‘NT AUTHORITY\IUSR’.” back from the server. I’ve tried numerous connection strings, all of which work under XP. I’ve also tried using the manual icacls changes suggested in the MS KB article. I tried setting the appPool property — still nothing. What am I missing? I’ve reverted everything back to how I found it before I started playing around. Do I need to add the IUSR to SQL Server itself? I didn’t see anything out there regarding this. Help!

    Thanks!!!!

  34. Scott says:

    Mike,

    I’m going to add this information to your blog as it may help other people. Your site is one of the best in terms of describing what’s going on with IIS 7 and Classic ASP.

    You wrote: “Regarding your comment on my blog post about asp scripts on Vista:

    What I talked about there was only related to Microsoft Access databases, and probably have no relevance on a SQL Server connection. Your problem seems to be related to identity and integrated security (or lack thereof). The IIS process have the identity “NT AUTHORITY\IUSR” but that user does not have any permissions to the SQL Server. What identity IIS is running under can be configured, and that is probably what differs between your Vista machine and XP machine.

    I’m not sure if this information might help?

    http://msdn2.microsoft.com/en-us/library/aa984236(VS.71).aspx”

    I kept playing around and I finally figured it out — you are completely correct in that SQL Server 2000 had a different set of issues than Access under IIS. What I needed to do was to change the security mode from Windows to Windows & SQL Server (this is the mixed mode). This is available under the Enterprise Manager by right clicking on the server name under the SQL Server Group. The top half of the security tab will let an administrator change the authentication mode. I was then able to access the server with ASP by using the following connection string: conn.ConnectionString=”Provider=sqloledb;Data Source=(local);Initial Catalog=NorthWind;User Id=sa;Password=;”

    I also tried creating other user names within the security settings of SQL Server and granted them the necessary permissions to the database and each was able to access it.

    So in summary, I didn’t need to change any permissions on the Temp directory nor did I need to change anything on the Application Pool in order to get Classic ASP to talk to SQL Server 2000 under IIS 7 and Vista. I just wanted to add this out here so that other people who are going through the same headache might have an easier time!

    Thanks again Mike for all of the help and suggestions! It is really appreciated!!!!

  35. Shahul says:

    How to activate asp in windows vista

  36. Michelle says:

    Thanks a bunch guys … esp Scott 🙂

  37. Kevin says:

    Thanks a million….perfect fix….couldn’t be happier….

  38. Edwin says:

    Hi Guys,

    If all these things don’t work anymore after installing SP1 try giving the IUSR account full permission to C:\Windows\Temp\ as well…

    I searched my ass off after the problems re-occured after installing SP 1. Tried everything again over and over nearly lost my mind 😉

    Looking at the process monitor I noticed that there where permission denied errors to this folder..

    Bye,

    Edwin

  39. Surya says:

    Thanks Mike for the wonderful information explained in an easy way!

    But my final word of appreciation goes to Edwin for his suggestion to give IUSR account full permission to C:\Windows\Temp as well. Only after that I could solve my problem!!

  40. john says:

    Thanks !!!!

  41. Matt Farmborough says:

    Edwin! You’re a legend mate. I’ve spent nearly 12 hours trying to find a solution. I tried everything I could find on google then I was reading through this and found your comment. IT WORKED! If we should ever meet I promise I will buy you all the beer you can drink mate.

    Thank you so much!!!

  42. Matt Wakeling says:

    Note for Vista x64 users…
    I’ve just gone through all the recommendations on this site and many, many others still to have the dreaded error ‘80004005′ message in IE, but before I resorted to launching my PC out of the second floor window I thought I would try systematically changing some of the other settings…
    luckily one of the first I changed was this little beauty which fixed the problem.

    IIS7\
    Features View\
    Application Pools\
    DefaultAppPool\
    Advanced Settings\
    Enable 32-bit Applications = TRUE

Leave a Reply

Twitter: @mikeplate