ASP.NET OLEDB Code Crashes When Deployed on IIS7

I am trying to write a simple website (ASP.NET v4) that will call Windows Search, find a specific file and return it to the user. As an example, I cited the following: it calls the Windows search service on "remoteserver" and returns the path to "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();

.. and this works fine in the Visual Studio 2010 development environment, the "result" contains the path to the file. However, if I distribute it to the local IIS7 server (running on server 2008), I get this error:

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.

I don’t understand where to go next. What do I need to do for IIS7, or code, or both, to make it work? Again, this works fine in VS2010 (tested on both Windows 7 and Windows 2008 Server).

+5
1

, Vista , IIS 2008 ? Provider=Search.CollatorDSO.1 ( .1).

. ( " ", asp.net). . .

+3

All Articles