質問

Windows検索を呼び出し、特定のファイルを見つけてユーザーに返す簡単なWebサイト(ASP.NET V4)を作成しようとしています。例として以下をまとめました。「Remoteserver」のWindows検索サービスを呼び出し、「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サーバーに展開すると(Server 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サーバーの両方でテストされています)。

役に立ちましたか?

解決

Vistaまたは古いOSで実行されていると思いますが、IISは2008サーバーで実行されていますか?試す Provider=Search.CollatorDSO.1 (注意してください .1).

編集: :検索のために別のユーザーアカウントを使用して動作する必要があります(ASP.NETアプリが実行するデフォルトの「ネットワークサービス」ではありません)。詳細については、コメントをご覧ください。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top