Global.ASA 在 IIS7.5 中不起作用

发布于 2024-12-01 20:38:21 字数 773 浏览 0 评论 0 原文

我有很多用旧的经典 ASP 编写的项目,其中 Global.asa 曾经工作得很好。由于我安装了带有 IIS7.5 的 Windows 7,所以我的项目都无法运行。

下面是 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

错误出现在这一行。参考了很多网站,甚至IIS.Net,但仍然没有成功。

objConn.Open connectionString

Application("otsAppConn") = objConn

end Sub

IIS 抛出的错误是

错误“80004005” /ot/admin/page1.asp,第 33 行 和旧版 IIS 系列中用于携带连接对象字符串的应用程序对象现在显示 Provider=MSDASQL.1; 而不是完整的连接字符串。

所有项目都被列为 IIS7.5 中的应用程序,我可以使用 appcmd 列表应用程序 看到它

。如果有人可以提供帮助,我将不胜感激。

I have many projects written in old classic ASP where Global.asa used to work perfectly fine. Since I have installed Windows 7 with 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..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帅的被狗咬 2024-12-08 20:38:22

看看提供的链接中的信息是否可以帮助您获得更好的调试信息。大约中间有一个设置可以打开,当我尝试在 iis 7.5 中运行经典 asp 时,可以打开它来查看错误代码背后的内容 http://learn.iis.net/page.aspx/564/classic-asp-script-error-messages-no-longer-shown-in-web-browser-by-default/

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/.

谜泪 2024-12-08 20:38:22

在 IIS 中进行长时间故障排除后设法解决了该问题。

  1. 将 DSN 连接提供程序转换为 Microsoft Access 驱动程序 (.mdb),而不是 Microsoft Access 驱动程序(.mdb、*.accdb)

  2. 在我的网站下的 IIS 中的自定义下创建连接字符串

    "/commit:MACHINENAME /section:connectionStrings /+"[connectionString='数据源=localhost;集成安全性=SSPI;初始目录=otmasterdb;',name='otmasterdb',providerName='Provider= Microsoft.Jet.OLEDB.4.0;']" 
    

    并提供与 DSN 连接相同的连接名称

  3. 将 Global.asa 连接字符串从“DSN=”更改为aaa;UID=管理员;PWD=;"只需删除后一部分即可将其更改为“aaa”。
    新代码如下所示:

    子应用程序_OnStart()
            暗淡 objConn,连接字符串
            设置 objConn = Server.CreateObject("ADODB.Connection")
            连接字符串 =“otsDSN”
    
            objConn.ConnectionTimeout = 5
            objConn.Open 连接字符串
    
            应用程序(“otsAppConn”)= objConn
    结束子
    

Managed to resolve the issue after long troubleshooting in IIS.

  1. Converted the DSN connection provider to Microsoft Access Driver (.mdb) instead of Microsoft Access Driver (.mdb, *.accdb)

  2. 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

  3. 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
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文