有一個asp檔案,因為include了很多asp檔案,,所以總的代碼行數非常多, 多到一定的數量后,運行程式就會出500錯誤,,而且是那種沒有任何提示的500錯誤。
肯定不是程式代碼本身的錯誤,我做過測驗,比如一個空的asp檔案,加入最簡單的代碼,比如<% a=1 %>,就這一行代碼,然后不停的復制,行數超過一定的數量后,就會出500錯誤, 具體的數量上限不確定,大約超過4萬3千代碼,就會出500錯誤。
請問大佬,這有沒有解決辦法,是需要更改某個iis的設定 嗎?、或者是需要更改服務器的某個設定?
uj5u.com熱心網友回復:
是不是超過了IIS設定的回應緩沖區限制。 可以用wsc之類的重構一下代碼。uj5u.com熱心網友回復:
打開 php 的錯誤顯示功能(php.ini:display_errors = On)根據頁面顯示的錯誤資訊排查
uj5u.com熱心網友回復:
拆。一個檔案4萬多行代碼,這也太瘋狂了吧。uj5u.com熱心網友回復:
不是一個檔案,而是include的檔案的代碼行數也算進入了,所以,拆檔案沒有用。
uj5u.com熱心網友回復:
只有一個曲線救國的辦法1、用include file
2、但是,include的檔案也算代碼行,所以include檔案多了,仍然會出錯,
3、所以,只能動態include檔案, include file本身時不支持動態檔案的,
4、沒辦法,只能用下面這個函式來執行include檔案,這就是變相的include 動態檔案了。
<% '解決include 沒有辦法用檔案變數, include的檔案 asp陳述句不可以分行,比如 if then end if 必須是一個asp陳述句
Function include_1(FilePath)
'Dim re_1,content_1,fso_1,f_1,aspStart_1,aspEnd_1
set stm_1=server.CreateObject("adodb.stream")
stm_1.Type=2 '以本模式讀取
stm_1.mode=3
stm_1.charset="utf-8"
stm_1.open
stm_1.loadfromfile server.MapPath(FilePath)
str_1=stm_1.readtext
stm_1.Close
set stm_1=nothing
content_1=str_1
set re_1=new RegExp
re_1.pattern="^\s*="
aspEnd_1=1
aspStart_1=inStr(aspEnd_1,content_1,"<%")+2
do while aspStart_1>aspEnd_1+1
Response.Write Mid(content_1,aspEnd_1,aspStart_1-aspEnd_1-2)
aspEnd_1=inStr(aspStart_1,content_1,"%\>")+2
Execute(re_1.replace(Mid(content_1,aspStart_1,aspEnd_1-aspStart_1-2),"Response.Write "))
aspStart_1=inStr(aspEnd_1,content_1,"<%")+2
loop
Response.write Mid(content_1,aspEnd_1)
'set stm_1=nothing
End Function
%>
uj5u.com熱心網友回復:
實在不行,就用 wsc 吧, runat=server 也可以試試。uj5u.com熱心網友回復:
IIS 回應緩沖限制uj5u.com熱心網友回復:
不是這個原因,試過將]IIS 回應緩沖限制設定成非常大,比如 2000000000, 已經上億了,相當于200M了,還是會出錯。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/12115.html
標籤:ASP
上一篇:vue無感重繪
