Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error connecting to Foxpro in webservice

Status
Not open for further replies.

BigKahunna

Programmer
Mar 18, 2003
9
0
0
GB
I'm getting the following error when connecting to a visual foxpro database using a web service.

The 'VFPOLEDB.1' provider is not registered on the local machine.

The exact same code works fine in a windows forms application, so I know it's not an issue with the connection string.

Any help would be gratefully appreciated.

[afro2]
 
Are you storing this webservice on a different machine that you are developing it on? If so, then it will need the proper driver installed.
 
At the moment the error occurs locally on the development machine. The only thing that is on another machine is the foxpro free table directory. Since the last post I have

-Installed the latest version of the OLE DB drivers from the MSDN site, but to no avail.

-Changed the local IIS account to run as an administrator.

-Logged on to the PC as the same account and used regsvr32 to register the vfpoledb.dll

The error message has now changed to:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.OleDb.OleDbException: Invalid path or file name.

Again the windows app works fine. I'm tearing my hair out on this one!

[afro2]
 
Managed to solve the problem by setting iis to use an account with permission to view the folder and using the following code to change the thread user for the web service

Code:
'Grab the current Http context 
Dim context As HttpContext = HttpContext.Current

'Set up a Service Provider based on this context
Dim iServiceProvider As IServiceProvider = CType(context, IServiceProvider)

'Create a type which represents an HTTPContext
Dim httpWorkerRequestType As Type = GetType(HttpWorkerRequest)

'Get the HttpWorkerRequest service from the service provider
Dim workerRequest As HttpWorkerRequest = _
CType(iServiceProvider.GetService(httpWorkerRequestType), HttpWorkerRequest)

'Get the token passed by IIS from the workerRequest service
Dim ptrUserToken As IntPtr = workerRequest.GetUserToken()

'Create a Windows Identity from the token
Dim winIdentity As New WindowsIdentity(ptrUserToken)

Thought I post the answer in case anyone has the same problem.

[afro2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top