ASP错误:msxml3.dll错误80070005,访问被拒绝。如何设置正确的权限?

ASP错误:msxml3.dll错误80070005,访问被拒绝。如何设置正确的权限?,xml,xslt,iis,asp-classic,Xml,Xslt,Iis,Asp Classic,我在浏览器中遇到了一些问题。我正在学习如何使用XSLT和ASP在浏览器中编辑XML,这是一个教程。我安装了IIS并启用了ASP功能,但当我尝试运行代码时,收到以下错误: msxml3.dll错误“80070005” 访问被拒绝 /xmlEdit/edittool.asp,第43行 我做错了什么?我觉得这可能与我在IIS中的权限或设置有关,但我对设置IIS和web测试环境是个新手。代码来自w3schools的exit XML教程 tool.xml: <?xml version="1.0" e

我在浏览器中遇到了一些问题。我正在学习如何使用XSLT和ASP在浏览器中编辑XML,这是一个教程。我安装了IIS并启用了ASP功能,但当我尝试运行代码时,收到以下错误:

msxml3.dll错误“80070005”

访问被拒绝

/xmlEdit/edittool.asp,第43行

我做错了什么?我觉得这可能与我在IIS中的权限或设置有关,但我对设置IIS和web测试环境是个新手。代码来自w3schools的exit XML教程

tool.xml:

<?xml version="1.0" encoding="UTF-8"?>
<tool>
  <field id="prodName">
    <value>HAMMER HG2606</value>
  </field>
  <field id="prodNo">
    <value>32456240</value>
  </field>
  <field id="price">
    <value>$30.00</value>
  </field>
</tool>

锤子HG2606
32456240
$30.00
tool.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
  <form method="post" action="edittool.asp">
  <h2>Tool Information (edit):</h2>
  <table border="0">
    <xsl:for-each select="tool/field">
    <tr>
      <td><xsl:value-of select="@id"/></td>
      <td>
      <input type="text">
      <xsl:attribute name="id">
        <xsl:value-of select="@id" />
      </xsl:attribute>
      <xsl:attribute name="name">
        <xsl:value-of select="@id" />
      </xsl:attribute>
      <xsl:attribute name="value">
        <xsl:value-of select="value" />
      </xsl:attribute>
      </input>
      </td>
    </tr>
    </xsl:for-each>
  </table>
  <br />
  <input type="submit" id="btn_sub" name="btn_sub" value="Submit" />
  <input type="reset" id="btn_res" name="btn_res" value="Reset" />
  </form>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>

刀具信息(编辑):

工具_updated.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
  <h2>Updated Tool Information:</h2>
  <table border="1">
    <xsl:for-each select="tool/field">
    <tr>
      <td><xsl:value-of select="@id" /></td>
      <td><xsl:value-of select="value" /></td>
    </tr>
    </xsl:for-each>
  </table>
  </body>
  </html>
</xsl:template>

更新的工具信息:

edittool.asp:

<%
function loadFile(xmlfile,xslfile)
Dim xmlDoc,xslDoc
'Load XML and XSL file
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load(xmlfile)
set xslDoc = Server.CreateObject("Microsoft.XMLDOM")
xslDoc.async = false
xslDoc.load(xslfile)
'Transform file
Response.Write(xmlDoc.transformNode(xslDoc))
end function

function updateFile(xmlfile)
Dim xmlDoc,rootEl,f
Dim i
'Load XML file
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load(xmlfile)

'Set the rootEl variable equal to the root element
Set rootEl = xmlDoc.documentElement

'Loop through the form collection
for i = 1 To Request.Form.Count
  'Eliminate button elements in the form
  if instr(1,Request.Form.Key(i),"btn_")=0 then
    'The selectSingleNode method queries the XML file for a single node
    'that matches a query. This query requests the value element that is
    'the child of a field element that has an id attribute which matches
    'the current key value in the Form Collection. When there is a match -
    'set the text property equal to the value of the current field in the
    'Form Collection.
    set f = rootEl.selectSingleNode("field[@id='" & _
    Request.Form.Key(i) & "']/value")
    f.Text = Request.Form(i)
  end if
next

'Save the modified XML file
xmlDoc.save xmlfile

'Release all object references
set xmlDoc=nothing
set rootEl=nothing
set f=nothing

'Load the modified XML file with a style sheet that
'allows the client to see the edited information
loadFile xmlfile,server.MapPath("tool_updated.xsl")
end function

'If form is submitted, update the XML file and display result
' - if not, transform the XML file for editing
if Request.Form("btn_sub")="" then
  loadFile server.MapPath("tool.xml"),server.MapPath("tool.xsl")
else
  updateFile server.MapPath("tool.xml")
end if
%>

第43行是

xmlDoc.save xmlfile
错误消息表明您的IUSR帐户没有对xml文件的写入权限,我假定该文件是tool.xml。右键单击它,选择属性,然后单击安全选项卡,从那里应该可以看到它

W3Schools教程很旧。我建议你换个新的

Server.CreateObject("Microsoft.XMLDOM")


这将调用msxml6.dll-这是处理器的最新版本遇到相同问题。尝试将此添加到经典ASP页面的顶部:

<% On Error Resume Next %>


微软的组件似乎有一个bug,它抛出了错误,尽管它实际上是工作的。通过抛出错误,它将停止处理页面。忽略错误,它工作得很好。

旁注:除非你有很好的理由去学习20年的技术,否则会考虑新的替代方案。ASP.Net可能更容易获得示例/帮助…在一篇文章中,用四个空格缩进您的代码,以将其格式化并正确显示。
<% On Error Resume Next %>