473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Windows service and VFPOLEDB

Hello

I've written a small C# program that uses VFPOLEDB it is working
perfectly. Then, I redesigned it to work as service (as described in
http://msdn.microsoft.com/library/de...plication.asp).

Unfortunetly, now my service is unable to use VFPOLEDB, stating that it
"is not registered" on my local machine.

Service is installed on LocalService account.

I suspect this has something with security policies, but I don't know
where to start :(

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #1
9 7756
Adam,

That error indicates that it would be something else than it not being
registered, but if it works for a normal application, then perhaps the error
is incorrect in itself.

There is an easy way to test this. Basically, make the service run
under the same user account which you ran the application on before you made
it a service. If it works, then you know it is a rights issue, otherwise,
it is an issue with the VFPOLEDB driver.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Adam Klobukowski" <at***@gabo.pl> wrote in message
news:cr**********@nemesis.news.tpi.pl...
Hello

I've written a small C# program that uses VFPOLEDB it is working
perfectly. Then, I redesigned it to work as service (as described in
http://msdn.microsoft.com/library/de...plication.asp).

Unfortunetly, now my service is unable to use VFPOLEDB, stating that it
"is not registered" on my local machine.

Service is installed on LocalService account.

I suspect this has something with security policies, but I don't know
where to start :(

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl

Nov 16 '05 #2
Nicholas Paldino [.NET/C# MVP] napisał(a):
Adam,

That error indicates that it would be something else than it not being
registered, but if it works for a normal application, then perhaps the error
is incorrect in itself.

There is an easy way to test this. Basically, make the service run
under the same user account which you ran the application on before you made
it a service. If it works, then you know it is a rights issue, otherwise,
it is an issue with the VFPOLEDB driver.

Hope this helps.

I tried it usnig LocalSystem account, and I have the same error. When I
tried to intall service as local user, I always had unknown
account/wrong pasword error, but they were ok.

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #3
Check if you have HKEY_CLASSES_ROOT\VFPOLEDB.1 in the registry.
If this key is not available, it means that it's installed as a User
component not as a System component, and that also means it should be used
from a Users context NOT from a service context.
However, if you want to try it from a service, you can run "regsvr32
vfpoledb.dll" and hope the keys are added to HKCR, if not you will have to
copy them manually from HKCU.
Note also that probably the COM classes have to instantiated in a STA,
Services have their threads running in an MTA, so you will have to spawn
another thread and initialize it's apartment state for MTA and access your
VFP components from this thread.

Willy.

"Adam Klobukowski" <at***@gabo.pl> wrote in message
news:cr*********@nemesis.news.tpi.pl...
Nicholas Paldino [.NET/C# MVP] napisał(a):
Adam,

That error indicates that it would be something else than it not
being registered, but if it works for a normal application, then perhaps
the error is incorrect in itself.

There is an easy way to test this. Basically, make the service run
under the same user account which you ran the application on before you
made it a service. If it works, then you know it is a rights issue,
otherwise, it is an issue with the VFPOLEDB driver.

Hope this helps.

I tried it usnig LocalSystem account, and I have the same error. When I
tried to intall service as local user, I always had unknown account/wrong
pasword error, but they were ok.

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl

Nov 16 '05 #4
Willy Denoyette [MVP] napisał(a):
Check if you have HKEY_CLASSES_ROOT\VFPOLEDB.1 in the registry.
Yes, there is. Both VFPOLEDB and VFPOLEDB.1
If this key is not available, it means that it's installed as a User
component not as a System component, and that also means it should be used
from a Users context NOT from a service context.
However, if you want to try it from a service, you can run "regsvr32
vfpoledb.dll" and hope the keys are added to HKCR, if not you will have to
copy them manually from HKCU.
Note also that probably the COM classes have to instantiated in a STA,
Services have their threads running in an MTA, so you will have to spawn
another thread and initialize it's apartment state for MTA and access your
VFP components from this thread.


Whoa, STA? MTA? (mail transfer agent? ;) )... where can I read something
about it?

I also thought about using a System.Diagnostics.Process to spawn process
from service that would do what my service would ask it to. Would it
work that way (ie, spawned process would use VFPOLEDB).

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #5
1. If you have version 8.0.0.3006, download the latest vfp provider from
http://msdn.microsoft.com/vfoxpro/do...s/default.aspx
2 Install
3. Re-reg the COM server by running regsvr32 "C:\Program Files\Common
Files\System\Ole DB\vfpoledb.dll"
(supposed this is the correct path).

Willy.

PS MTA is multi threaded apartment, STA is single threaded apartment.

"Adam Klobukowski" <at***@gabo.pl> wrote in message
news:cr**********@atlantis.news.tpi.pl...
Willy Denoyette [MVP] napisał(a):
Check if you have HKEY_CLASSES_ROOT\VFPOLEDB.1 in the registry.


Yes, there is. Both VFPOLEDB and VFPOLEDB.1
If this key is not available, it means that it's installed as a User
component not as a System component, and that also means it should be
used from a Users context NOT from a service context.
However, if you want to try it from a service, you can run "regsvr32
vfpoledb.dll" and hope the keys are added to HKCR, if not you will have
to copy them manually from HKCU.
Note also that probably the COM classes have to instantiated in a STA,
Services have their threads running in an MTA, so you will have to spawn
another thread and initialize it's apartment state for MTA and access
your VFP components from this thread.


Whoa, STA? MTA? (mail transfer agent? ;) )... where can I read something
about it?

I also thought about using a System.Diagnostics.Process to spawn process
from service that would do what my service would ask it to. Would it work
that way (ie, spawned process would use VFPOLEDB).

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl

Nov 16 '05 #6
Willy Denoyette [MVP] napisał(a):
1. If you have version 8.0.0.3006, download the latest vfp provider from
http://msdn.microsoft.com/vfoxpro/do...s/default.aspx
2 Install
3. Re-reg the COM server by running regsvr32 "C:\Program Files\Common
Files\System\Ole DB\vfpoledb.dll"
(supposed this is the correct path).


I have version 8.0.0.3117 (I reinstlled it to be sure I have latest
varsion, and I had).

This is the transcription of the exception that happens (translated from
polish, so may be not 100% accurate):

System.InvalidOperationException: Dostawca 'VFPOLEDB.1' is no registered
on local computer. ---> System.Data.OleDb.OleDbException: No avialible
information about error: REGDB_E_CLASSNOTREG(0x80040154).
--- End of trace ---
at System.Data.OleDb.OleDbConnection.CreateProviderEr ror(Int32 hr)
at
System.Data.OleDb.OleDbConnection.CreateProvider(O leDbConnectionString
constr)
at System.Data.OleDb.OleDbConnection.Open()
at Hanyang_Usluga.HanyangUsluga.OnStart(String[] args)

Connection string is checked and is 100% ok. (Works in program that
doues exactly the same but is not a service).

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #7
I went a bit around the problem. I copied VFPOLEDB registry keas from
HKCR to HKLM\SOFTWARE\Classes. The 'unregistered VFPOLEDB' problem is
gone, but any first operation on the database (SELECT for example)
throws invalid path or filename exception (but path and file (table)
name is ok - double, triplechecked).

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #8

"Adam Klobukowski" <at***@gabo.pl> wrote in message
news:cr**********@nemesis.news.tpi.pl...
I went a bit around the problem. I copied VFPOLEDB registry keas from HKCR
to HKLM\SOFTWARE\Classes. The 'unregistered VFPOLEDB' problem is gone, but
any first operation on the database (SELECT for example) throws invalid
path or filename exception (but path and file (table) name is ok - double,
triplechecked).

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl


Adam,

Please don't hack the registry, do as I asked from the beginning, run as
administrator and re-register the DLL using regsvr32.

Now up to your next problem, If you VFP files are on a local disk, make sure
the service account has access to the files, so check your ACL's.
If your VFP files (what you call a Database) happen reside on a network
share, you are probably running in the security context of a service which
has no network access. In this case you will have to run your service with a
domain account's credentials.

Note that all these problems are due to the fact that you are using a
personal desktop style database as a server product.

Willy.
Nov 16 '05 #9
Willy Denoyette [MVP] napisał(a):
"Adam Klobukowski" <at***@gabo.pl> wrote in message
news:cr**********@nemesis.news.tpi.pl...
I went a bit around the problem. I copied VFPOLEDB registry keas from HKCR
to HKLM\SOFTWARE\Classes. The 'unregistered VFPOLEDB' problem is gone, but
any first operation on the database (SELECT for example) throws invalid
path or filename exception (but path and file (table) name is ok - double,
triplechecked).

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl

Adam,

Please don't hack the registry, do as I asked from the beginning, run as
administrator and re-register the DLL using regsvr32.


I did so, it didn't help.
Now up to your next problem, If you VFP files are on a local disk, make sure
the service account has access to the files, so check your ACL's.
If your VFP files (what you call a Database) happen reside on a network
share, you are probably running in the security context of a service which
has no network access. In this case you will have to run your service with a
domain account's credentials.

Note that all these problems are due to the fact that you are using a
personal desktop style database as a server product.


I worked around the problem by changing the account that service works
to Admin (that is 'Administrator' in polish version), and now it works
flawlessly.

--
Semper Fidelis

Adam Klobukowski
at***@gabo.pl
Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
0
by: Kenneth P | last post by:
Hi, I'm going to use Visual Foxpro VFPOLEDB.DLL driver and VFP databases on the web according to these two Microsoft articles This is about how to use vfpoledb with asp.net pages, web services...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
6
by: Agnes | last post by:
I can show the login.aspx page in my window2003 IIS6 . However, after I click the "ok" buttonm it said The 'VfpOleDB.1' provider is not registered on the local machine. (1)I can run the...
0
by: Agnes | last post by:
I can show the login.aspx page in my window2003 IIS6 . However, after I click the "ok" buttonm it said The 'VfpOleDB.1' provider is not registered on the local machine. (1)I can run the...
2
by: cgcalonso | last post by:
Hi, I have an WinForms application that reads data from a dbf file. I have installed the VFPOLEDB.1 provider and the app worked fine in my developement computer, for which I have administrative...
0
ck9663
by: ck9663 | last post by:
select dbf.*, 'fromfilename' as recordsource into x from OPENROWSET('VFPOLEDB','c:\my\full\path\';'';'', 'select * from mytable') dbf I have 2+Million records on the dbf file and I'm trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.