views:

117

answers:

0

Hi, I have 2 components as below 1) a windows service that reads DLL path, properties and functions from a config file and executes the function of the DLL using reflections.Assemply --- It works perfectly fine with any DLL (without DB connection). Idea is to create a windows service which will perform any task specified in the config at regular intervals. Its completely configurable from DLL names to property names and functions. 2) A Dll that connects to a oracle database using DB authentications provided via its properties and executes a Stored procedures --- It also works fine while testing from a windows application. The Dll uses system.data.oracleclient for DB operations.

Problem is when above service calls the above DLL, and in tern the DLL tries to initialise DB connection... the error is thrown as "The type initializer for 'System.Data.OracleClient.OracleConnection' threw an exception."

I have checked 1) all parameters sent to DLL, all are perfectly fine 2) Executed the service using "Local System", "Network Service" and logged in user 3) Used above windows service for other purpose like log writing & sending email (Only problem seems to be opening DB connection. My Oracle DB is on separate machine on same LAN) 4) Have put the code of DLL in a test windows service to directly work with Oracle DB. It also works fine.

only problem seems to be combination of Windows service loading the DLL using reflections.assemble and initialising the DB connection. Error is thrown at line -- cn = new OracleConnection

Please help