木子屋 Dnawo's BLOG

msxml3.dll 错误 '80070005' 拒绝访问解决方法

👤 dnawo 📅 2012-02-09 👁 11662 👍 0 💬 0 🔄 本站原创
今天查看日志时发现有个ASP页面偶尔会运行出错,提示:

msxml3.dll 错误 '80070005'
拒绝访问。

问题还原

经过一番分析,提取出了主要的代码:

<%
'编码转换
Function BytesToBstr(body,Cset)
	dim objstream
	set objstream = Server.CreateObject("adodb.stream")
	objstream.Type = 1
	objstream.Mode =3
	objstream.Open
	objstream.Write body
	objstream.Position = 0
	objstream.Type = 2
	objstream.Charset = Cset
	BytesToBstr = objstream.ReadText 
	objstream.Close
	set objstream = nothing
End Function

'获取全部内容
Function HttpGet(weburl) 
	Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
	With Retrieval 
		.Open "GET", weburl, False, "", "" 
		.Send 
		HttpGet = .ResponseBody
	End With 
	HttpGet = BytesToBstr(HttpGet,"GB2312")
	Set Retrieval = Nothing 
End Function

Response.Write(HttpGet("http://member1.taobao.com/member/userProfile.jhtml?userID=huxueqi2011"))
%>

运行结果:

图片

解决方法

将代码中Microsoft.XMLHTTP替换成Msxml2.ServerXMLHTTP即可。

原因分析

通过Firebug发现访问上边url时有个302跳转:

图片

于是尝试在服务器建立一个302跳转页面希望对问题进行重现:

Redirect.asp:
<%
Response.Status="302 Moved Temporarily"
Response.AddHeader "Location","http://www.qq.com/"
Response.End
%>

遗憾的是问题没有再次出现,所以具体的错误原因暂且不知。

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 淘宝基础概念 下一篇 → XMLHTTP和ServerXMLHTTP的区别