我正在尝试从VB.NET应用程序(3.5Framework)发送JSON对象。
我正在使用以下代码:
Private Function sendSMS()
Dim objHTTP As Object
Dim json As String
Dim result As String
Dim URL As String
json = fJSON()
objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "https://api.XXXXXXXXX.com/api/3.0/sms/send"
objHTTP.Open("POST", URL, False)
objHTTP.setRequestHeader("Content-type", "application/json")
objHTTP.send(json)
result = objHTTP.responseText
objHTTP = Nothing
End Function
Private Function fJSON() As String
fJSON = "{"
fJSON = fJSON & """api_key"":""XXXXXXXXXXXXXXXXXXX"","
fJSON = fJSON & """concat"":1,"
fJSON = fJSON & """fake"":1,"
fJSON = fJSON & """messages"":["
fJSON = fJSON & "{"
fJSON = fJSON & """from"":""SHOP"","
fJSON = fJSON & """to"":""3400000000"","
fJSON = fJSON & """text"":""LOREM IPSUM"""
fJSON = fJSON & "}]}"
End Function
但是我在行代码中得到了这个错误:
线路代码:
objHTTP.setRequestHeader("Content-type", "application/json")
错误:
System.Runtime.InteropServices.COMException (0x80004005):没有特别错误的
怎么啦?
发布于 2018-05-16 02:41:02
有时候,用户没有足够的权限来运行一些COM方法。这里您的异常是"System.Runtime.InteropServices.COMException (0x80004005)“,它是基于System.Runtime.InteropServices.COMException的。为了解决这个问题,您会以管理员的身份运行Visual并检查wheather逻辑是否适合您吗?
https://stackoverflow.com/questions/50367902
复制相似问题