Link to home
Start Free TrialLog in
Avatar of Dan Violet Sagmiller (He/Him)
Dan Violet Sagmiller (He/Him)Flag for United States of America

asked on

C# wcf void main

I have a C# WCF project (vs2010u) and I need to be able to point to a start up method.  Most applications have static void main, but I don't see that here.

How can I get a WCF service to automatically execute a particular method on startup?

Also, is there a close event that I can have it respond to as well?

Thanks.

Avatar of kaufmed
kaufmed
Flag of United States of America image

How are you hosting the service--in IIS or in a self-hosted setup (e.g. console application or windows service)?
Avatar of Dan Violet Sagmiller (He/Him)

ASKER

I've been using debug mode, in VS2010 so far, just now paying attention to the fact it was going through IIS.  However, I'm planning on building this for a console app.  I'm guessing that the console app will call it on its void main.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'll add this line:  I didn't realize some of the difficulties in producing the console app version.  The first I tried was windows service, which was a huge pain.  Then I tried console app from http://msdn.microsoft.com/en-us/library/ms731758.aspx, and then called the initializer from the main() in the console app.