32ビットASPアプリケーションからWindows 2008 X64インデックスサービスを照会する方法は?

StackOverflow https://stackoverflow.com/questions/3904552

質問

最近、私はASPクラシックサイトをW2K3サーバーからW2K8 64環境に移動することを伴う問題に出くわしました。 ASPクラシックで動作するインデックスサービスを取得することが含まれていました。私は多くのソリューションを試してみたところ、すべてを検索しましたが、それらはすべて失敗しました。

問題:32ビットアプリケーションプール(ASPクラシック用)のASPページで64ビットインデックスサービスを実行して、インデックスサービスへのリクエストを実行すると、サーバーオブジェクトがロードできなかったエラーが発生しました。インデックスサービスが実行されていて、インデックスがインデックス作成されたサイトのドキュメントを含むフォルダーは、64ビットモードとプールで32ビットモードで実行されていました。実行することはできませんでした。

提案されたソリューションのいくつかは、新しい「Windows検索」を使用するようにコードを書き換えることでしたが、これも64ビットで実行されているため、32ビットアプリケーションモードで実行できませんでした。プールで32ビットの互換モードをオフに切り替えると、ASPサイトで使用されているデータベースやその他のcomオブジェクトが機能していません。

役に立ちましたか?

解決


数日後、私はほとんどあきらめましたが、夜中にそれをすべて機能させるという素晴らしいアイデアを得ました。 32ビットアプリケーションモードで実行されているサイトのインデックス付きディレクトリを含む仮想ディレクトリを使用して、64ビットモードで実行されているWebサーバーのサブドメインにAJAX呼び出しを行うとどうなりますか。

翌日、落ち着きのない睡眠の翌日、私は仕事に取り掛かり、IIS7に新しいサブドメインを追加して、Webサイトのインデックス付きディレクトリに仮想ディレクトリを追加しました。リクエストハンドラーを含む「indencer.asp」ページを追加しました。

<%@ Language=VBScript %><%


Option explicit
response.buffer=true

dim RequestIndex, strFileError, RequestSearchString, FSOA, RequestMax


RequestIndex=request.querystring("Index")
RequestSearchString=request.querystring("Search")
RequestMax=request.querystring("Size")


' INDEXER 
sub DoIndexSearch(target, RequestIndex)
dim foundfilearray:foundfilearray=false
dim ixQuery   ' Index Server query object.
set ixQuery = Server.CreateObject("ixsso.Query")
if (Err.description <> "") Then
    strFileError= ("<div><strong>Query object Error : " & Err.description & ".</strong></div>")
    response.write strFileError 
    Exit sub
end if

ixQuery.Query =(target)
'ixQuery.SortBy  = "DocLastSavedTm[d]"
ixQuery.SortBy  = "Rank[d]"
ixQuery.Columns  = "FileName," 'Parameter: columns returned (one this case a one dimensional array)
ixQuery.LocaleID = 1043  'Parameter: language 
ixQuery.MaxRecords =RequestMax   'Parameter:  max returned documents 
ixQuery.Catalog = RequestIndex 'IndexService ' Which indexing service

' Create a search utility object to allow us to specify the search type as deep,meaning  it will search recursively down through the directories
dim util      
set util = Server.CreateObject("ixsso.Util")
util.AddScopeToQuery ixQuery, Server.MapPath(RequestIndex), "deep"
if (Err.description <> "") Then
    strFileError= ("<div><strong>Search Utility Error : " & Err.description & "</strong></div>")
    response.write strFileError 
    Exit sub
end if


' Run the query (i.e. create the recordset).
dim QueryRS
set queryRS = ixQuery.CreateRecordSet("nonsequential")
' Check the query result. If it timed out or return no records, then show
' an appropriate message. Otherwise, show the hits.
if (Err.description <> "") Then
    strFileError= "<div><strong>search error : " & Err.description & "</strong></div>"
    response.write strFileError 
    queryRS.close
    set queryRS = nothing
    set ixQuery = nothing
    set util = nothing 
    Exit sub

elseif queryrs.recordcount = 0 then
    strFileError="<div><strong>no documents found.</strong></div>"
    response.write strFileError 
    queryRS.close
    set queryRS = nothing
    set ixQuery = nothing
    set util = nothing 
    Exit sub
else
    FSOA= QueryRS.getrows()
    queryRS.close
    set queryRS = nothing
    set ixQuery = nothing
    set util = nothing 
    Exit sub
end if

end Sub


call DoIndexSearch(RequestSearchString,RequestIndex)


' TESTING PURPOSE  
dim strTestResult
strTestResult= "<html><head></head><body style=""font-family:Verdana, arial"">" 
strTestResult=strTestResult& "<h1>Testing 64bit classic asp indexing using windows 2008 64bit server</h1>" 
strTestResult=strTestResult& "<h3>Search in index <em>"&RequestIndex&"</em>  for <em>"&RequestSearchString&"</em> with max <em>"&requestMax&"</em> results</h3>" 
strTestResult=strTestResult& "<p>Using a seperate website running a 64bit classic pool, wich contains a virtual directory named after the Index which contains the path to the directory of the website that is indexed.</p>" 
strTestResult=strTestResult& "<p>The returned results is a one dimensional array containing the filenames where searchstring is found in. This array can be passes back using ajax/json</p>"  

if isarray(fsoa) then
    strTestResult=strTestResult& " <hr>" 
    strTestResult=strTestResult& "<fieldset><legend>Found items for "&RequestSearchString&"  </legend>"

    dim xloop:xloop=0
    strTestResult=strTestResult& " <ol>" 

    for each xloop in fsoa
        strTestResult=strTestResult& "<li>"&Xloop&" </li>" 
    next

    strTestResult=strTestResult& " </ol></fieldset></body></html>"
    strTestResult=strTestResult& "<hr>" 
    strTestResult=strTestResult& "<h1>AJAX return array</h1>" 
else
    strTestResult=strTestResult& " no items found" 
end if

' response.write strTestResult ' (Remark when done testing)
' END TESTING



' RETURN INDEXING RESULT TO AJAX/JSON CALLER (one dim array)
if  strFIleError="" then
    xloop=0
    dim ajaxresult

    for each xloop in FSOA
        ajaxresult=ajaxresult & ucase(Xloop) &"|" 
    next

    ajaxresult=Left(ajaxresult,Len(ajaxresult)-1)
    response.write ajaxresult
end if


%>

次に、32ビットアプリケーションモードで実行されているWebサイトの1つでリクエストページを作成しました。

dim FSOA 'return documents file array

'search inside documents 
sub DoSearchText(target, indexservice)
'target = search string
'indexservice = catalog name (index service)

dim IndexArray() 'one dimensional array for index result
dim xmlhttp, tempArray, IndexUrl

'url to the 64bit indexer subdomain
IndexURL = ("http://indextest.subdomain.local/indexer.asp?Index="&IndexService&"&Search="&target&"&Size=50") 
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
xmlhttp.open "GET", IndexURL, false 
xmlhttp.send ""  

if xmlhttp.status >= 400 and xmlhttp.status <=599 then
    response.write " error processing: " &xmlhttp.status &" - "&xmlhttp.statusText
else
    tempArray= xmlhttp.responseText 
end if

set xmlhttp = nothing  
'put result into a array
FSOA= split(tempArray,"|")
end Sub


call DoSearchText("chapter one", "sitebooks")

if isarray(FSOA) then

    dim docloop
    for each docloop in FSOA
        response.write "<div>"&docloop&"</div>"
    next
else
    response.write "No documents found"
end if

`

説明:

  • 解析インデックスサービスカタログ名、検索文字列、最大文書
  • サブドメインでは、インデックスが作成されたディレクトリの元の場所にリダイレクトする仮想ディレクトリ(インデックスカタログと呼ばれる)を作成します
  • リクエストコールを処理するIndencer.aspページを追加します
  • 元のWebページの既存のリクエストオブジェクトコードを変更して、上記のサブドメインにajax呼び出しを行う

利点:

  • 32ビットアプリケーションモードで実行されているASPクラシックWebサイトから、64ビットアプリケーションと返信結果にAJAXリクエストを行います。
  • 含めることもできます Adobe PDF ifilter (64bit)PDFをインデックスし、PDFファイル内で読み取ります。
  • 既存のASPコードのサイトを簡単に変更できます。マイナーな変更
  • 個別の64ビットプールとサブドメインでインデクサーを実行します
  • 1つの場所で簡単にメンテナグしている複数のカタログを追加します
  • 不可能を可能にする:32ビットアプリケーションモードで64ビットインデックスサービスでASPクラシックを実行する
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top