【发布时间】:2012-02-19 20:04:49
【问题描述】:
在我输入一些代码后开始遇到错误之前,此站点运行正常。该代码不在主页上,但现在不会加载任何网站页面。我在 IIS 中重新启动了站点,但没有帮助。
这是我输入的代码:
'Prepare to parse XML
Set objXML = Server.CreateObject(Microsoft.XMLDOM)
'Set Asynchoronous = false
objXML.async = False
'Load the XML file.
'User Server.MapPath method is the XML is located in your site.
'Else you can use the absolute path.
objXML.Load (Server.MapPath(Products.xml))
'If there is any errors pasring the file the notify
If objXML.parseError.errorCode = 0 Then
'Response.Write(objXML.parseError.reason)
Else objXML.parseError.errorCode <> 0 Then
'Get ALL the Elements by the tag name product
Set products = objXML.getElementsByTagName(product)
Select Case iItemID
Case 1
aParameters = Array(products.item(0).childNodes(0).text, products.item(i).childNodes(2).text, products.item(i).childNodes(2).text)
Case 2
aParameters = Array(products.item(1).childNodes(0).text, products.item(i).childNodes(2).text, products.item(i).childNodes(2).text)
End Select
' Return array containing product info.
GetItemParameters = aParameters
End If
使用经典 ASP 在 Windows 7 中运行 IIS。使用 Notepad++ 进行编辑。
这是 XML 文件:
<configuration>
<products>
<product>
<image>
<![CDATA[ /Images/Atlas Gloves.jpg ]]>
</image>
<name>
<![CDATA[ Atlas Nitrile Touch Gloves ]]>
</name>
<description>
<![CDATA[ Atlas Nitrile Touch is available in 6 vibrant colors, and is America’s #1 glove for the Lawn and Garden market. Atlas gloves have a breathable nylon back and are machine washable. Like a “second skin,” these gloves are the most comfortable! Atlas Nitrile gloves are the #1 gardening gloves. Atlas Nitrile gloves act like a "second skin" between the user and their work, offering full dexterity and grip. Atlas Nitrile Gloves are perfect for gardening, but their uses expand to so many places – the woodshop, the workshop, the workplace. ]]>
</description>
<size>
<![CDATA[ Small, Medium ]]>
</size>
<color>
<![CDATA[ Purple, Pink, Green, Orange ]]>
</color>
</product>
</products>
</configuration>
【问题讨论】:
-
实际的错误信息会有所帮助。
-
我没有收到错误消息。它只是永远不会加载。
-
查看你的服务器日志。
-
我检查了服务器日志,但在此之前它停止了,没有错误消息。我可以看到当天早些时候的错误消息,所以它正在记录,但显然这让它变冷了。最后,我不得不在 IIS 中重新启动 App Pool。我之前已经重新启动了该站点,并且所有内容都显示为正在运行。重新启动应用程序池后,它又恢复了。感谢您的回复。
-
@Darren:你打开服务器端调试了吗?如果是这样,请将其关闭。然后,您可以修复此代码。如果您在问题中添加 products.xml 的示例,有人可能会向您展示您应该如何编写函数。
标签: asp-classic