« Previous Next »

Answered Thread: Cannot connect to MS Access database with Classic ASP in IIS 7.0

Last post 04-17-2007 12:24 PM by bills. 4 replies.

 

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 03-27-2007, 10:53 AM

    • mofo5000
    • Not Ranked
    • Joined on 03-27-2007, 2:26 PM
    • Posts 4

    Cannot connect to MS Access database with Classic ASP in IIS 7.0

    Hi,

    I have just begun to accustom myself with IIS 7.0 that came with my Vista Ultimate upgrade after having successfully used IIS 5.1 on XP PRO.  Please note I was no expert with ISS 5.1 though my website had worked perfectly with it for months which relies heavily on classic ASP and a single MS Access database.

    Basically I get this message when the ASP code attempts to connect to the database:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Microsoft Access Driver] Disk or network error.

    /Adaction/Database_Open.asp, line 15

     

    And here is the ASP code where line 15 is 'Connection.Open ConnectionString':

    <%
    Dim Connection
    Dim RecordSet

    ConnectionString = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("ADA_Adaction.mdb")

    ' Create object to connect to database
    Set Connection = Server.CreateObject("ADODB.Connection")

    ' Create object to hold data
    Set RecordSet = Server.CreateObject("ADODB.Recordset")

    ' Open database connection
    Connection.Open ConnectionString
    %>

     

    Heres what I have already tried to rectify the problem since I "believe" this is what got IIS 5.1 rolling:

    * Set the website folder security so that IUSR is Read only

    * Set the Database itself so that IUSR is Read only

     

    Can anyone point me in the right direction?

     

    Thankyou

    Luke

  • 03-27-2007, 11:57 AM In reply to

    • tomkmvp
    • Top 10 Contributor
    • Joined on 03-20-2003, 10:27 AM
    • Central NJ
    • Posts 7,167
    • IIS MVPs

    Re: Cannot connect to MS Access database with Classic ASP in IIS 7.0

    mofo5000:
    I have just begun to accustom myself with IIS 7.0 that came with my Vista Ultimate upgrade ...
    You're in the wrong forum then, please see http://forums.iis.net/1044/ShowForum.aspx ...
  • 03-28-2007, 6:27 AM In reply to

    • mofo5000
    • Not Ranked
    • Joined on 03-27-2007, 2:26 PM
    • Posts 4

    Re: Cannot connect to MS Access database with Classic ASP in IIS 7.0

    Ok, after some research on this forum and MS KB926939 (http://support.microsoft.com/kb/926939) heres how I got my Access DB working again.  I'll attempt to make this a bit easier going on people who do not have huge amounts of experience (like me) with this 'guide'.  If anyone has any reservations about the methods used here please speak up, give some reasons why and how to remedy them!!  Thanks.

    Please note I have no idea how to UNDO the commands below.  If anyone does it would sure be handy to know how.  People dont seem to be very good at demonstrating how to reverse these types of actions!  MS did not serve up any form of reversal either.  Here goes:-

     

    First off, using 'Command Prompt' with 'Run as administrator' (right click the command prompt icon for this option), paste in the following (one at a time) and press enter.  Command prompt will write back to say weather these were successfully applied or not. 

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

    Note: This command enables every user to create files and directories in the temporary directory.

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

    Note: The user who creates a file or a directory in the temporary directory is the CREATOR OWNER. The CREATOR OWNER access control entry grants a user complete control over the file or the directory. Other users cannot access these files and directories because they are not the CREATOR OWNER. 

     

    The command below was not in the MS KB article but many people around this forum have suggested it:

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

    It did not work for me however but is apparently supposed to do the same job as the next step below.  So:

    (Note: Along the way here you will be accessing windows system folders etc.  Vista will frequently ask you to confirm your actions, apparently this is normal.  Again, Im no expert.)

    Go to:

    • Start \ Computer \ C: \ Windows \ System32 \ InetSrv \ config
    • Now COPY the file 'ApplicationHost.Config'
    • Paste it onto your desktop (You should make a backup copy at this point to be safe as well)
    • Now change the '.config file extension to '.txt'
    • Open the file with Notepad
    • Click 'Find' under the 'Edit' menu
    • Use this line     <processModel identityType="NetworkService" />   as your find keyword

     Your search should dig up some script that looks like this:

    <applicationPoolDefaults>
      <processModel identityType="NetworkService" />
    </applicationPoolDefaults>

    You now want to change the middle line so that it becomes this:

    <applicationPoolDefaults>
      <processModel identityType="NetworkService" loadUserProfile="false" />
    </applicationPoolDefaults>

    • Now save the file
    • Convert the '.txt' back to '.config'
    • Copy the new file
    • Go back to:         Start \ Computer \ C: \ Windows \ System32 \ InetSrv \ config
    • Paste and overwrite the existing 'ApplicationHost.Config' file

    At this point, test your application via localhost.  If everthing else on your application is setup ok (more often that not, access rights are overlooked) it will run.

     

    Hope this helps!

  • 04-14-2007, 3:06 PM In reply to

    • bones72
    • Not Ranked
    • Joined on 04-14-2007, 7:02 PM
    • Posts 1

    Re: Cannot connect to MS Access database with Classic ASP in IIS 7.0

    You are a genious!  I have tried to fix this problem for a couple of days.  I have probably been to every article on the net for IIS7 & ASP, none of them really helped.  Followed your instructions and within 2 minutes I was back in business!

    Thanks!

  • 04-17-2007, 12:24 PM In reply to

    • bills
    • Top 25 Contributor
    • Joined on 02-03-2006, 12:33 PM
    • Redmond, WA
    • Posts 433

    Re: Cannot connect to MS Access database with Classic ASP in IIS 7.0

    You guys must be running in a different appPool other than DefaultAppPool.  The cmd above only sets the loadUserProfile setting for the DefaultAppPool.  The only difference with the cmd provided last, is that it sets the default for the loadUserProfile setting on all AppPools.

    Bill

    ~~~~~~~~~~~~~~~~~~~~~~~~
    Bill Staples
    Product Unit Manager, IIS
    blog: http://blogs.iis.net/bills
Page 1 of 1 (5 items)