不是所有服务器上都有这个问题,在我的电脑和租的一个虚拟主机上始终正常运行,很稳定。
但在客户的电脑上一般是第一次有时能正常运行,但刷新2次后可能导致IIS无响应,过一段时间后,出现提示链接人数过多,稍后再试...
12 个解决方案
#1
程序优化最重要
#2
逐个Function分析,然后Err.Clear
#3
我碰到过,是新浪的。可导致CPU长时间使用率为90%以上。
#4
代码贴出来看看。
#5
call GetNewsList(theDate,"工行快讯") '调用程序
'函数
Sub GetNewsList(theDate,theType)
pstr = GetPage(GetUrl(theDate,theType))
select case theType
case "工行快讯","财经动态"
wstr = GetContent(pstr,"-------------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","pub/img/point_3.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"top","middle")
wstr = Replace(wstr,"../detail.jsp?","html/news/viewz.asp?")
wstr = Replace(wstr,"334496","3E3E3E")
wstr = Replace(wstr,"450","90%")
LastStr = wstr
case "工行快讯1","财经动态1"
wstr = GetContent(pstr,"----------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","../../pub/img/arrow_2.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"../detail.jsp?","viewz.asp?")
wstr = Replace(wstr,"#334496","#3E3E3E")
wstr = Replace(wstr,"=450","=90%")
wstr = Replace(wstr,"=328","=80%")
wstr = Replace(wstr,"right","center")
wstr = Replace(wstr,"=26","=5%")
wstr = Replace(wstr,"=86","=15%")
wstr = Replace(wstr,"=21","=25")
LastStr = wstr
end select
End sub
Function GetUrl(theDate,theType)
select case theType
case "工行快讯"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=工行快讯&row=1&length=6"
case "财经动态"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=财经动态&row=1&length=6"
case "工行快讯1","财经动态1"
GetUrl=theDate
end select
End function
Function GetPage(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
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 = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function GetContent(str,start,last,n)
If Instr(lcase(str),lcase(start))>0 then
select case n
case 0 '左右都截取(都取前面)(去处关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))-1)
case 1 '左右都截取(都取前面)(保留关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))+Len(last)-1)
case 2 '只往右截取(取前面的)(去除关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
case 3 '只往右截取(取前面的)(包含关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
case 4 '只往左截取(取后面的)(包含关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))+Len(start)-1)
case 5 '只往左截取(取后面的)(去除关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))-1)
case 6 '只往左截取(取前面的)(包含关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))+Len(start)-1)
case 7 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start))+1)
case 8 '只往左截取(取前面的)(去除关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))-1)
case 9 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start)))
end select
Else
GetContent=""
End if
End function
'函数
Sub GetNewsList(theDate,theType)
pstr = GetPage(GetUrl(theDate,theType))
select case theType
case "工行快讯","财经动态"
wstr = GetContent(pstr,"-------------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","pub/img/point_3.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"top","middle")
wstr = Replace(wstr,"../detail.jsp?","html/news/viewz.asp?")
wstr = Replace(wstr,"334496","3E3E3E")
wstr = Replace(wstr,"450","90%")
LastStr = wstr
case "工行快讯1","财经动态1"
wstr = GetContent(pstr,"----------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","../../pub/img/arrow_2.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"../detail.jsp?","viewz.asp?")
wstr = Replace(wstr,"#334496","#3E3E3E")
wstr = Replace(wstr,"=450","=90%")
wstr = Replace(wstr,"=328","=80%")
wstr = Replace(wstr,"right","center")
wstr = Replace(wstr,"=26","=5%")
wstr = Replace(wstr,"=86","=15%")
wstr = Replace(wstr,"=21","=25")
LastStr = wstr
end select
End sub
Function GetUrl(theDate,theType)
select case theType
case "工行快讯"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=工行快讯&row=1&length=6"
case "财经动态"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=财经动态&row=1&length=6"
case "工行快讯1","财经动态1"
GetUrl=theDate
end select
End function
Function GetPage(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
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 = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function GetContent(str,start,last,n)
If Instr(lcase(str),lcase(start))>0 then
select case n
case 0 '左右都截取(都取前面)(去处关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))-1)
case 1 '左右都截取(都取前面)(保留关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))+Len(last)-1)
case 2 '只往右截取(取前面的)(去除关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
case 3 '只往右截取(取前面的)(包含关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
case 4 '只往左截取(取后面的)(包含关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))+Len(start)-1)
case 5 '只往左截取(取后面的)(去除关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))-1)
case 6 '只往左截取(取前面的)(包含关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))+Len(start)-1)
case 7 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start))+1)
case 8 '只往左截取(取前面的)(去除关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))-1)
case 9 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start)))
end select
Else
GetContent=""
End if
End function
#6
我觉得程序中的操作虽然不少,但关键问题可能是服务器IIS配置有什么问题。
这个程序在我的电脑上运行就一点问题都没有,在租用的虚拟主机上也正常运行。
只是在客户电脑上(winxp)配置IIS后,运行该程序,有时第一次可以正常显示,刷新一下就不行了,提示链接人数多,稍后再试什么的...
原来程序中用到fso,如果诺顿的禁止教本设置开着,就是这种现象,程序运行后白屏,无响应,只能注销或重启电脑。
这个程序在我的电脑上运行就一点问题都没有,在租用的虚拟主机上也正常运行。
只是在客户电脑上(winxp)配置IIS后,运行该程序,有时第一次可以正常显示,刷新一下就不行了,提示链接人数多,稍后再试什么的...
原来程序中用到fso,如果诺顿的禁止教本设置开着,就是这种现象,程序运行后白屏,无响应,只能注销或重启电脑。
#7
程序完了吗?
好像问题不在上面啊。
好像问题不在上面啊。
#8
资源被占用了。。。
看看程序部分哪里是不是忘记释放了
看看程序部分哪里是不是忘记释放了
#9
楼主,绝对是操作系统跟iis的问题
xp的iis跟server版的功能差很多呢,告诉客户装个server版就好了。
xp的iis跟server版的功能差很多呢,告诉客户装个server版就好了。
#10
出现在线人数过多的情况是因为xp的iis默认只允许10人最多在线,有时候做完一个网页,刷新10遍,第11次就显示在线人数过多了。
#11
和电脑性能有关,也和被抓的网站有关。
#12
关键程序就是这些,被抓网站没有问题,他那不能抓的时候,我这是可以抓的。
我也认为是操作系统和iis的问题,关键是不知道如何设置能解决这个问题。如果实在没有好的解决办法只能让客户装个server版试试了。
我也认为是操作系统和iis的问题,关键是不知道如何设置能解决这个问题。如果实在没有好的解决办法只能让客户装个server版试试了。
#1
程序优化最重要
#2
逐个Function分析,然后Err.Clear
#3
我碰到过,是新浪的。可导致CPU长时间使用率为90%以上。
#4
代码贴出来看看。
#5
call GetNewsList(theDate,"工行快讯") '调用程序
'函数
Sub GetNewsList(theDate,theType)
pstr = GetPage(GetUrl(theDate,theType))
select case theType
case "工行快讯","财经动态"
wstr = GetContent(pstr,"-------------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","pub/img/point_3.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"top","middle")
wstr = Replace(wstr,"../detail.jsp?","html/news/viewz.asp?")
wstr = Replace(wstr,"334496","3E3E3E")
wstr = Replace(wstr,"450","90%")
LastStr = wstr
case "工行快讯1","财经动态1"
wstr = GetContent(pstr,"----------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","../../pub/img/arrow_2.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"../detail.jsp?","viewz.asp?")
wstr = Replace(wstr,"#334496","#3E3E3E")
wstr = Replace(wstr,"=450","=90%")
wstr = Replace(wstr,"=328","=80%")
wstr = Replace(wstr,"right","center")
wstr = Replace(wstr,"=26","=5%")
wstr = Replace(wstr,"=86","=15%")
wstr = Replace(wstr,"=21","=25")
LastStr = wstr
end select
End sub
Function GetUrl(theDate,theType)
select case theType
case "工行快讯"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=工行快讯&row=1&length=6"
case "财经动态"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=财经动态&row=1&length=6"
case "工行快讯1","财经动态1"
GetUrl=theDate
end select
End function
Function GetPage(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
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 = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function GetContent(str,start,last,n)
If Instr(lcase(str),lcase(start))>0 then
select case n
case 0 '左右都截取(都取前面)(去处关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))-1)
case 1 '左右都截取(都取前面)(保留关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))+Len(last)-1)
case 2 '只往右截取(取前面的)(去除关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
case 3 '只往右截取(取前面的)(包含关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
case 4 '只往左截取(取后面的)(包含关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))+Len(start)-1)
case 5 '只往左截取(取后面的)(去除关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))-1)
case 6 '只往左截取(取前面的)(包含关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))+Len(start)-1)
case 7 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start))+1)
case 8 '只往左截取(取前面的)(去除关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))-1)
case 9 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start)))
end select
Else
GetContent=""
End if
End function
'函数
Sub GetNewsList(theDate,theType)
pstr = GetPage(GetUrl(theDate,theType))
select case theType
case "工行快讯","财经动态"
wstr = GetContent(pstr,"-------------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","pub/img/point_3.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"top","middle")
wstr = Replace(wstr,"../detail.jsp?","html/news/viewz.asp?")
wstr = Replace(wstr,"334496","3E3E3E")
wstr = Replace(wstr,"450","90%")
LastStr = wstr
case "工行快讯1","财经动态1"
wstr = GetContent(pstr,"----------------------------------------------","【",0)
wstr = Replace(wstr,"../images/arrow_2.gif","../../pub/img/arrow_2.gif")
wstr = Replace(wstr,"height=15","")
wstr = Replace(wstr,"width=15","")
wstr = Replace(wstr,"../detail.jsp?","viewz.asp?")
wstr = Replace(wstr,"#334496","#3E3E3E")
wstr = Replace(wstr,"=450","=90%")
wstr = Replace(wstr,"=328","=80%")
wstr = Replace(wstr,"right","center")
wstr = Replace(wstr,"=26","=5%")
wstr = Replace(wstr,"=86","=15%")
wstr = Replace(wstr,"=21","=25")
LastStr = wstr
end select
End sub
Function GetUrl(theDate,theType)
select case theType
case "工行快讯"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=工行快讯&row=1&length=6"
case "财经动态"
GetUrl="http://www.icbc.com.cn/news/hotspot.jsp?column=财经动态&row=1&length=6"
case "工行快讯1","财经动态1"
GetUrl=theDate
end select
End function
Function GetPage(url)
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
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 = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function GetContent(str,start,last,n)
If Instr(lcase(str),lcase(start))>0 then
select case n
case 0 '左右都截取(都取前面)(去处关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))-1)
case 1 '左右都截取(都取前面)(保留关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))+Len(last)-1)
case 2 '只往右截取(取前面的)(去除关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
case 3 '只往右截取(取前面的)(包含关键字)
GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
case 4 '只往左截取(取后面的)(包含关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))+Len(start)-1)
case 5 '只往左截取(取后面的)(去除关键字)
GetContent=Left(str,InstrRev(lcase(str),lcase(start))-1)
case 6 '只往左截取(取前面的)(包含关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))+Len(start)-1)
case 7 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start))+1)
case 8 '只往左截取(取前面的)(去除关键字)
GetContent=Left(str,Instr(lcase(str),lcase(start))-1)
case 9 '只往右截取(取后面的)(包含关键字)
GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start)))
end select
Else
GetContent=""
End if
End function
#6
我觉得程序中的操作虽然不少,但关键问题可能是服务器IIS配置有什么问题。
这个程序在我的电脑上运行就一点问题都没有,在租用的虚拟主机上也正常运行。
只是在客户电脑上(winxp)配置IIS后,运行该程序,有时第一次可以正常显示,刷新一下就不行了,提示链接人数多,稍后再试什么的...
原来程序中用到fso,如果诺顿的禁止教本设置开着,就是这种现象,程序运行后白屏,无响应,只能注销或重启电脑。
这个程序在我的电脑上运行就一点问题都没有,在租用的虚拟主机上也正常运行。
只是在客户电脑上(winxp)配置IIS后,运行该程序,有时第一次可以正常显示,刷新一下就不行了,提示链接人数多,稍后再试什么的...
原来程序中用到fso,如果诺顿的禁止教本设置开着,就是这种现象,程序运行后白屏,无响应,只能注销或重启电脑。
#7
程序完了吗?
好像问题不在上面啊。
好像问题不在上面啊。
#8
资源被占用了。。。
看看程序部分哪里是不是忘记释放了
看看程序部分哪里是不是忘记释放了
#9
楼主,绝对是操作系统跟iis的问题
xp的iis跟server版的功能差很多呢,告诉客户装个server版就好了。
xp的iis跟server版的功能差很多呢,告诉客户装个server版就好了。
#10
出现在线人数过多的情况是因为xp的iis默认只允许10人最多在线,有时候做完一个网页,刷新10遍,第11次就显示在线人数过多了。
#11
和电脑性能有关,也和被抓的网站有关。
#12
关键程序就是这些,被抓网站没有问题,他那不能抓的时候,我这是可以抓的。
我也认为是操作系统和iis的问题,关键是不知道如何设置能解决这个问题。如果实在没有好的解决办法只能让客户装个server版试试了。
我也认为是操作系统和iis的问题,关键是不知道如何设置能解决这个问题。如果实在没有好的解决办法只能让客户装个server版试试了。