Global.ASA does not work in IIS7.5
I have many projects written in old classic ASP where Global.asa used to work perfectly fine. Since I have installed Windows 7 wit开发者_JAVA百科h IIS7.5, none of my projects are working.
Below is the code for Global.asa
<Script language=vbscript runat = server>
Sub Application_OnStart()
dim objConn, connectionString
set objConn = Server.CreateObject("ADODB.Connection")
connectionString = "DSN=otsDSN; UID=admin;PWD=;"
objConn.ConnectionTimeout = 5
The error comes in this line. Have referred many websites, even IIS.Net but still no luck.
objConn.Open connectionString
Application("otsAppConn") = objConn
end Sub
The error thrown by IIS is
error '80004005' /ot/admin/page1.asp, line 33 and the Application object which used to carry the connection object string in older family of IIS now showing, Provider=MSDASQL.1; instead of complete connection string.
All the projects are listed as Application in IIS7.5 which I could see using the appcmd list apps
Appreciate if someone can help on this..
see if the information in the provided link helps you get some better debug info. About halfway down there is a setting you can turn on that allowed me to see what was behind the error code when I was trying to run a classic asp in iis 7.5 http://learn.iis.net/page.aspx/564/classic-asp-script-error-messages-no-longer-shown-in-web-browser-by-default/.
Managed to resolve the issue after long troubleshooting in IIS.
Converted the DSN connection provider to Microsoft Access Driver (.mdb) instead of Microsoft Access Driver (.mdb, *.accdb)
Created Connection String in IIS under my website under Custom
"/commit:MACHINENAME /section:connectionStrings /+"[connectionString='Data Source=localhost;Integrated Security=SSPI;Initial Catalog=otmasterdb;',name='otmasterdb',providerName='Provider=Microsoft.Jet.OLEDB.4.0;']"
and gave the Connection Name same as the DSN connection
Changed the Global.asa connectionString from "DSN=aaa;UID=admin;PWD=;" to "aaa" only by removing the latter portion.
The new code looks like this:Sub Application_OnStart() dim objConn, connectionString set objConn = Server.CreateObject("ADODB.Connection") connectionString = "otsDSN" objConn.ConnectionTimeout = 5 objConn.Open connectionString Application("otsAppConn") = objConn end Sub
精彩评论