Windows Search を呼び出し、特定のファイルを見つけてユーザーに返す単純な Web サイト (ASP.NET v4) を作成しようとしています。例として次のようにまとめました。「remoteserver」で Windows Search サービスを呼び出し、「somefile.txt」のパスを返します。
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';";
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = string.Format(
"SELECT System.ItemPathDisplay, System.ItemType FROM " +
" sytelhp.systemindex WHERE SCOPE='file://remoteserver/archive' AND CONTAINS(\"System.FileName\", " +
" '\"*{0}*\"')", "somefile.txt");
conn.Open();
OleDbDataReader rdr = cmd.ExecuteReader();
string result=rdr[0].ToString();
..これはVisual Studio 2010開発環境でうまく機能し、「結果」にはファイルへのパスが含まれています。ただし、ローカルの IIS7 サーバー (サーバー 2008 で実行) に展開すると、次のエラーが発生します。
The parameter is incorrect.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: The parameter is incorrect.
次はどこに行こうか迷っています。IIS7、コード、またはその両方を機能させるには、何をする必要がありますか? 繰り返しますが、これは VS2010 内で正常に動作します (Windows 7 と Windows 2008 Server の両方でテスト済み)。