環境:Windows Server 2008(64bit) Enterprise、IIS7.0、ASP+ACCESS
<% Dim Conn,ConnStr Set Conn=Server.CreateObject("Adodb.Connection") ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("db.mdb") Conn.open ConnStr If err Then err.clear Set Conn = Nothing Response.Write "數據庫連接錯誤,請檢查連接參數!" Response.End End If %>
今天在新裝的系統中寫了一段ASP連接ACCESS數據庫的語句,放到IIS中運行顯示500錯誤,第一反應"父路徑"沒啓用,馬上試一下:
IIS7——對應站點——功能試圖——ASP——啓用父路徑
再試,仍是500錯誤= =!
後來在網上找到解決方案,如下:
原文(http://blog.fufuok.com/Article/iis7-asp-access-500.aspx)
產生的原因是:
在64位系統中,IIS7應用程序池默認沒有啓用32位程序,也就是說如果你使用的是64位操作系統,而沒有64位的Jet 4.0驅動程序,那麼就要在IIS7中啓用32位程序。
解決方法如下:
If you are running a 64-bit OS, there is no 64-bit Jet 4.0 driver. You need to configure your application pool to run 32-bit.
I struggled with this error for a couple hours before I found this:
http://brh.numbera.com/blog/index.php/2007/03/27/using-myodbc-with-aspnet-in-iis7-on-vista-x64