Windows Services and Enterprise library DAAB

J

Jac

Hey,

Is it possible to use Enterprise Library in a Windows Service?

I work in VS2005 and made an Windows Service, but I don't see an
app.config file. So, I created one appname.exe.config.

Then I went to the enterprise configuration tool to set my connection
string (I did the same in a WindowsForm application and it worked).

The appname.exe and the appname.exe.config I set under
C:\Program Files\Default Company Name\appname

When I start the service it always stop immediately with that error :
"The AppName service on Local Computer started and then stopped. Some
services stop automatically if they have no work to do, for example, the
Performance Logs and Alerts service."

If I run the service with
Database db = DatabaseFactory.CreateDatabase(); in comments then it
starts and run normally.

I don't see why it don't work in a Windows service.

Thanks,
nic
 
M

Mark Rae

I work in VS2005 and made an Windows Service, but I don't see an
app.config file. So, I created one appname.exe.config.

1) Copy the values from appname.exe.config

2) Right-click the project, then click Add, New Item

3) Highlight Application Configuration file and click OK

4) Copy the values into the new app.config file - when you compile your
service, its name will be changed automatically for you...
 
J

Jac

thanks, I didn't know that.

The rest I found also. My fault was that I didn't copied the
enterprise.dll 's to the directory where the service is running.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top