MSXML“系统无法找到指定的资源”

发布于 2024-09-29 16:49:59 字数 1426 浏览 0 评论 0原文

我有一个使用 MSXML 发布 XML 文档的函数,该文档昨天开始失败,尽管没有对代码进行任何更改。函数如下:

Public Function PostFile(ByVal address As String, ByVal data As Byte()) As xmldocument
    Dim xmlHTTP As New MSXML2.XMLHTTP
    Dim response As New XmlDocument

    Dim xmlDoc As New MSXML2.DOMDocument

    Try
        xmlDoc.load(data)
        xmlHTTP.open("post", address, False)
        xmlHTTP.send(xmlDoc)

        If xmlHTTP.responseXML.xml <> String.Empty Then
            response.LoadXml(xmlHTTP.responseXML.xml)
            Return response
        Else
            Dim result As String = "<NO_Response><Error>the post succeeded to " + address + " but there was no responce returned</Error><Hint>Check FireWall Settings</Hint></NO_Response>"
            response.loadxml(result)
            Return response
        End If

    Catch ex As Exception
        'Error logging code removed

    End Try
    Return Nothing
End Function

XML 文档和传入的地址都是正确的 - 导致错误的行是 xmlHTTP.send(xmlDoc)。我在两台不同的机器上尝试过此操作,每次都出现相同的错误,并且还尝试重新安装 MSXML3,但没有成功。

抛出的异常是:

InnerException: Nothing 
Message:        "The system cannot locate the resource specified. "
Source:         "msxml3.dll"    
StackTrace:     "   at MSXML2.XMLHTTPClass.send(Object varBody)    at comms.HTTPHandler.PostFile(String address, Byte[] data) in D:\SCC\Main\Sender\Http.vb:line 42"

I have a function which uses MSXML to post an XML document which yesterday started failing despite no change being made to the code. The function is as follows:

Public Function PostFile(ByVal address As String, ByVal data As Byte()) As xmldocument
    Dim xmlHTTP As New MSXML2.XMLHTTP
    Dim response As New XmlDocument

    Dim xmlDoc As New MSXML2.DOMDocument

    Try
        xmlDoc.load(data)
        xmlHTTP.open("post", address, False)
        xmlHTTP.send(xmlDoc)

        If xmlHTTP.responseXML.xml <> String.Empty Then
            response.LoadXml(xmlHTTP.responseXML.xml)
            Return response
        Else
            Dim result As String = "<NO_Response><Error>the post succeeded to " + address + " but there was no responce returned</Error><Hint>Check FireWall Settings</Hint></NO_Response>"
            response.loadxml(result)
            Return response
        End If

    Catch ex As Exception
        'Error logging code removed

    End Try
    Return Nothing
End Function

The XML document and the address being passed in are both correct - the line which causes the error is xmlHTTP.send(xmlDoc). I have tried this on 2 different machines with the same error each time and have also tried resinstalling MSXML3, with no success.

The exception thrown is:

InnerException: Nothing 
Message:        "The system cannot locate the resource specified. "
Source:         "msxml3.dll"    
StackTrace:     "   at MSXML2.XMLHTTPClass.send(Object varBody)    at comms.HTTPHandler.PostFile(String address, Byte[] data) in D:\SCC\Main\Sender\Http.vb:line 42"

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

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

发布评论

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

评论(2

離殇 2024-10-06 16:49:59

事实证明这是一个网络问题 - 我一开始并没有怀疑这一点,因为错误出现得如此之快,这并不表明端点有问题。问题在于已添加到防火墙(不要问为什么)的规则阻止与目标地址的通信。

It turned out to be a networking issue - I didn't suspect this at first as the error was raised so quickly which didn't suggest an issue with the endpoint. The problem was with a rule which had been added (don't ask why) to the firewall preventing communication with the destination address.

别忘他 2024-10-06 16:49:59

如果你只是处理xml或者dtd处于离线状态,你可以使用:
xmlDoc.resolveExternals = False

If you are just processing the xml or dtd is offline, you can use:
xmlDoc.resolveExternals = False

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