Previous Next

Thread: ASP & Jet Provider

Last post 08-21-2008 9:36 AM by ma_khan. 11 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (12 items)

Sort Posts:

  • 01-23-2007, 3:35 AM

    • jmiko
    • Not Ranked
    • Joined on 01-23-2007, 8:23 AM
    • Posts 2
    • jmiko

    ASP & Jet Provider

    Hi,

    I try windows vista on my box and discover that I can't use my ASP application due to error:

    Unable to establish connection to database.

    • Error information:
      ADODB.Connection (0xE7A)
      Provider cannot be found. It may not be properly installed.

     

    My connection string is 

    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Test\test.mdb;Persist Security Info=False"

     

    I found several articles about differences between 32-bit and 64-bit environments but it is too strange that microsoft doesn't provide compatibility for ASP applications with MSAccess databases under vista.

    Is there a way to connect to mdb-file with 64-bit IIS7?

    Thanks,
    Michael.
     

  • 01-29-2007, 11:56 AM In reply to

    • thomad
    • Top 25 Contributor
    • Joined on 08-20-2002, 3:28 PM
    • Redmond
    • Posts 387
    • thomad

    Re: ASP & Jet Provider

    Michael,

     There is not 64-Bit Jet Provider as far as I know. Your best bet is to run your applicaiton in a 32-Bit Application Pool.

     How to do it:
    1) Create a new Application Pool in the UI or via command-line, e.g.
    %windir%\system32\inetsrv\appcmd add AppPool My32BitAppPool
    2) Set it to run in 32-Bit Mode by setting "Enable 32-Bit Applications" in the AppPool's "Advanced Settings" or via command-line:
    %windir%\system32\inetsrv\appcmd set AppPool My32BitAppPool -enable32BitAppOnWin64:true
    3) Run your application in this AppPool by changing it in the UI (Application: Basic Settings) or via command-line:
    %windir%\system32\inetsrv\appcmd set app "Default Web Site/test" -applicationPool:My32BitAppPool

     Hope this helps.

     

    Thomas Deml
    Senior Program Manager
    Internet Information Services
    Microsoft Corp.
  • 01-31-2007, 1:33 AM In reply to

    • jmiko
    • Not Ranked
    • Joined on 01-23-2007, 8:23 AM
    • Posts 2
    • jmiko

    Re: ASP & Jet Provider

    Thomas,

    thank you. It works perfectly!

    Best regards,

    Michael.
     

  • 04-12-2007, 12:48 AM In reply to

    • craiger316
    • Not Ranked
    • Joined on 04-12-2007, 4:32 AM
    • Posts 3
    • craiger316

    Re: ASP & Jet Provider

    Thomas, thanks so much for that tip it got me one step closer to migrating a classic ASP site over to IIS 7 on 64bit vista.  I still have a missing piece to my puzzle though, I cannot for the life of me get a connection to my Access database when running the code under IIS. I get the dreaded when attempting to connect:

    Microsoft JET Database Engine : Unspecified error : -2147467259

    However, if I take the offending code out and place it into a .vbs file (changing Response.write to MsgBox and Server.CreateObject to CreateObject), everything works just fine.  I run the .vbs file from the command line using wscript from the sysWOW64 directory (otherwise you get Provider not Found).

    Just to make sure it wasn't permissions, I moved the .mdb to a new folder and gave full perms to "Everyone".

    Here is the code:

    <%
     Dim mobjConnection
     Dim mobjRecordSet

     Private Sub Initialize()
      Dim lstrQuery
      Dim rows
      Set mobjConnection = Server.CreateObject("ADODB.Connection")
      mobjConnection.Provider = "Microsoft.Jet.OLEDB.4.0"
      Response.write("<h1>Got here</h1>")
      On Error Resume Next
      mobjConnection.Open "E:\\temp\\status.mdb"
     
     If Err.number <> 0 then
         Response.write("<h1>" & Err.source & ":" & Err.description & ":" & Err.number & "</h1>")
      End If

      Response.write("<h1>Got here</h1>")
      
     End Sub

      Call Initialize()
     
    %>

    I saw an article which stated that Windows\Temp folder needed to be permed right as well, I did that, still no luck. In my .vbs version I do infact see a temp file being created in my user account's Temp folder (Jet apparently uses the %TEMP% var from System env settings when running under IIS, but uses %TEMP% from the user's env settings when running under a user's account).

    Any help would be greatly appreciated.  It has to be some configuration I missed.

    Thanks in advance.

  • 04-12-2007, 1:14 AM In reply to

    • thomad
    • Top 25 Contributor
    • Joined on 08-20-2002, 3:28 PM
    • Redmond
    • Posts 387
    • thomad

    Re: ASP &amp; Jet Provider

    Ok,

    try this and I bet it works:

    %windir%\system32\inetsrv\appcmd set AppPool -appPool.name:My32BitAppPool -processModel.loadUserProfile:false

    Assuming this is the problem, here is the reason:

    We are now loading the user profile when we start a worker process. This means that every worker process gets its own %temp% directory that is ACLed (I like 'permed' :)) so that only the worker process identity has access to it. For the default IIS worker process identity the %temp% directory is %windir%\ServiceProfiles\NetworkService\AppData\Local\Temp. Problem is however that ASP impersonates the authenticated user, e.g. the anonymous user IUSR. This user doesn't have access to the worker process's temp directory. Access is heavily using the temp directory though.

    If you don't load the user profile every worker process parties in the %windir%\temp directory instead having its own %temp% directory. For security reasons we rather not do this but the errors Access and other applications throw are extremely hard to troubleshoot. Ideally we find a solution that is both secure and doesn't break existing apps. We didn't find it yet however :(.

     Another way to fix the problem is to perm the %temp% directory in a way that allows authenticated users. If you use anonymous authentication for example you should be able to fix the problem by allowing IUSR access to %windir%\ServiceProfiles\NetworkService\AppData\Local\Temp, e.g.

    ICACLS %windir%\ServiceProfiles\NetworkService\AppData\Local\Temp /grant IUSR:(IO)(OI)(CI)F
    ICACLS %windir%\ServiceProfiles\NetworkService\AppData\Local\Temp /grant IUSR:F

    Hope this helps.


     

    Thomas Deml
    Senior Program Manager
    Internet Information Services
    Microsoft Corp.
  • 04-12-2007, 7:37 AM In reply to

    • craiger316
    • Not Ranked
    • Joined on 04-12-2007, 4:32 AM
    • Posts 3
    • craiger316

    Re: ASP &amp; Jet Provider

    Thomas you have made my morning, actually my week!  That worked like a charm (I tried option 1).  Is that option part of the gui or only accessible via the command line?

     After making that setting change what I did was I started systematically reverting all the permissions I had set for IUSR/IIS_USRS on the folder where the mdb existed.  I was wondering if you could give me a little IIS 7 "101" and tell me why I don't have to perm my Access database (or it's folder) so conn.open can open it?  I was pretty sure with my experience in previous versions of IIS/ASP/Windows that was always a must?  But now it seems the default perms for the folder (i.e. the ones Windows sets up for you when you create a new folder through explorer) work just fine.

    Thank you once again for you help I can't tell you how much I appreciate a quick (and correct) response!

  • 04-12-2007, 11:22 AM In reply to

    • thomad
    • Top 25 Contributor
    • Joined on 08-20-2002, 3:28 PM
    • Redmond
    • Posts 387
    • thomad

    Re: ASP &amp; Jet Provider

    Nice to hear that it works.

    I'm not sure I understand your questions but here are some thoughts.

    Folder permissions are usually inherited from the root of your drive. The root permissions are set when you format the drive. Permissions after a format on W2K are probably different from a format on W2K3 from a format on Vista. That's my guess. On Vista (what I'm running right now) "Authenticated Users" have "modify" rights on the root of my drive - this means they can create/read/write/change files.

    The ACL on the INETPUB\WWWROOT directory is different though.

     We ACL it so that Users/Authenticated Users only have read access. Administrators are the only ones who have write access. This is a problem if you have your Access database underneath INETPUB\WWWROOT because if you want to add a row you have to write to it as a standard user and it will fail.

    For security reasons we think it is better though to only give Administrators write access by default. Ideally you put your MDB in a different directory outside the URL namespace, i.e. \inetpub\wwwroot. This is a good security practice anyway.

    Does this help?

    Thomas Deml
    Senior Program Manager
    Internet Information Services
    Microsoft Corp.
  • 04-12-2007, 11:35 AM In reply to

    • craiger316
    • Not Ranked
    • Joined on 04-12-2007, 4:32 AM
    • Posts 3
    • craiger316

    Re: ASP &amp; Jet Provider

    thomad:

    Does this help?

    Very much so, thank you.  I guess I completely disregarded the fact that on my other system we were running the app out of the directory IIS had setup as wwwroot.  In the new system, I created my own root specifically for this application and just had IIS use it.  That would probably explain things.

    Again, thank you for you time and effort helping me with this problem. 


     

  • 04-22-2008, 9:42 AM In reply to

    • Regneva
    • Not Ranked
    • Joined on 04-22-2008, 1:39 PM
    • Posts 2
    • Regneva

    Re: ASP &amp; Jet Provider

    I was having this trouble and found your post by Google!  Thank you very much!  You solved a problem I've been trying to figure out for months!

  • 08-21-2008, 4:44 AM In reply to

    • NiteFly
    • Not Ranked
    • Joined on 08-21-2008, 8:36 AM
    • Posts 1
    • NiteFly

    Re: ASP &amp; Jet Provider

     Hi there

    i have the same problem as described on post #1

    i run under XP 64bit with IIS 6

     But i can't execute the scripts as suggested by Micheal in post #2, simply it seems my XP 64 doesn't have the requested file '%windir%\system32\inetsrv\appcmd' thjat i suppose to exist in Vista only.

    I know how to create a new Application Pool, but i don't know hot set it to run in 32-Bit Mode.

     

    Any hints ?

     

    Thanks in advance.

     

    Max

     

     

  • 08-21-2008, 8:47 AM In reply to

    • Regneva
    • Not Ranked
    • Joined on 04-22-2008, 1:39 PM
    • Posts 2
    • Regneva

    Re: ASP &amp; Jet Provider

    Hmm, that is interesting.  Prior to my upgrade to Vista, I was running XP 64bit, and it ran my website with the database just fine. 

    I'm not sure how to change it, outside of Vista...  Sorry.  You could check the different dialogs within the application pool settings.   

  • 08-21-2008, 9:36 AM In reply to

    • ma_khan
    • Top 25 Contributor
    • Joined on 03-16-2008, 4:26 PM
    • Posts 274
    • ma_khan

    Re: ASP &amp; Jet Provider

     Max,

    Appcmd is a utility that comes only with IIS 7 ... that is the reason it will run on Vista but not on XP 64 which is IIS 6 

    Regards,
    MA Khan
    http://www.iisworkstation.com

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
Page 1 of 1 (12 items)
Page view counter