Iis 7 如何从32位ASP应用程序查询Windows 2008 x64索引服务?

Iis 7 如何从32位ASP应用程序查询Windows 2008 x64索引服务?,iis-7,asp-classic,windows-server-2008-r2,indexing-service,Iis 7,Asp Classic,Windows Server 2008 R2,Indexing Service,最近我偶然发现了一个问题,涉及将asp经典站点从w2k3服务器移动到w2k8 64环境。它涉及让索引服务与asp classic一起工作。我到处寻找,尝试了许多解决方案,但都失败了 问题是: 在32位应用程序池上运行64位索引服务(适用于asp classic) 运行对索引服务的请求的ASP页面导致错误,服务器对象无法加载。尽管索引服务正在运行,并且包含索引所在站点文档的文件夹在64位模式下运行,而池在32位模式下运行。无法运行 一些建议的解决方案是重写代码以使用新的“windows搜索”,但由

最近我偶然发现了一个问题,涉及将asp经典站点从w2k3服务器移动到w2k8 64环境。它涉及让索引服务与asp classic一起工作。我到处寻找,尝试了许多解决方案,但都失败了

问题是: 在32位应用程序池上运行64位索引服务(适用于asp classic) 运行对索引服务的请求的ASP页面导致错误,服务器对象无法加载。尽管索引服务正在运行,并且包含索引所在站点文档的文件夹在64位模式下运行,而池在32位模式下运行。无法运行

一些建议的解决方案是重写代码以使用新的“windows搜索”,但由于它也是以64位运行,因此无法以32位应用程序模式运行。由于asp站点使用的数据库和其他com对象无法正常工作,因此在池中关闭32位兼容模式。


过了几天,我几乎放弃了,但在半夜我有了一个聪明的想法,使它全部工作。如果我对Web服务器上的子域进行ajax调用,该子域以64位模式运行,虚拟目录包含以32位应用程序模式运行的站点的索引目录,该怎么办

第二天,在不安的睡眠之后,我开始工作,在IIS7中添加了一个新的子域,在网站的索引目录中添加了虚拟目录。并添加了一个“indexer.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


%>

这是一个很好的调查和+1。我会用一个单独的自我接受的答案来回答这个问题(例如,如何从32位ASP应用程序查询Windows 2008 x64索引服务?)。有些人在SO上发布“文章”可能有点滑稽。你也可以从社区中获得一些额外的有价值的见解。谢谢Kev,改变了这个问题。@Bjork我很久以前就已经回答了,当时也接受了。有人删除了我的答案。我又加了一次。。。。
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