Classic ASPを使用すると、辞書オブジェクトの配列をアプリケーションオブジェクトに配置することが可能かどうかを知ることができますか?私は試してみましたが、アプリケーションプールの下にあるスクリプトに約50,000回もヒットした後に、この行が実行されたときに、「トラップ可能な」C0000005エラーが生成されます:dictLanguage = Application( "lang")application()オブジェクトに辞書オブジェクトの配列を格納する - Classic ASP
しかし数日。アプリケーションオブジェクトを別の変数に割り当てたやり方と関係がありますが、コピーではなくポインタを渡すと思っていましたか?私より賢い人はここで何が起こっているのか知っていますか?
if isempty(Application("lang")) then
''# called when first visitor hits the page (following server reboot or app pool recycle)
init()
dictLanguage=Application("lang")
else
''# called for all other page hits
dictLanguage=Application("lang") ''# ***** TRAPPABLE ERROR after a few thousand page views *******
end if
''# // fill the application object with an array containing 10 dictionary objects, each holding a different language.
''# // This function appears to run just fine.
function init
Set initcn = Server.CreateObject("ADODB.Connection")
initcn.Open dbConStr
strSQL = "SELECT languageNo,quickRef,text FROM tblTranslation"
Set rs = initcn.Execute(strSQL)
dim d(10)
Set d(1)=Server.CreateObject("Scripting.Dictionary")
Set d(2)=Server.CreateObject("Scripting.Dictionary")
Set d(3)=Server.CreateObject("Scripting.Dictionary")
Set d(4)=Server.CreateObject("Scripting.Dictionary")
Set d(5)=Server.CreateObject("Scripting.Dictionary")
Set d(6)=Server.CreateObject("Scripting.Dictionary")
Set d(7)=Server.CreateObject("Scripting.Dictionary")
Set d(8)=Server.CreateObject("Scripting.Dictionary")
Set d(9)=Server.CreateObject("Scripting.Dictionary")
Set d(10)=Server.CreateObject("Scripting.Dictionary")
while not rs.eof
a=rs("languageNo")
b=rs("quickRef")
c=rs("text")
''# on error resume next
d(a).Add b,c
rs.movenext
wend
initcn.close
''# Storing the array in the Application object
Application.Lock
Application("lang") = d
Application.Unlock
end function
私は大きなものをデータベースやファイルに入れます。 –
既にデータベースに入っています。私は速度のためのアプリケーションオブジェクトのデータをキャッシュしようとしています。すべてのページでデータベースを再クエリすると、パフォーマンスが低下します。 –
それから、 '.GetRows()'を使用します。 –