Created simple WCF Service project with some services.
How to define project entry logic as Main()
in console app, Application_Start()
in WPF App.cs or in ASP.NET global.asax.cs?
Asked
Active
Viewed 95 times
0

kmatyaszek
- 19,016
- 9
- 60
- 65

Arman Hayots
- 2,459
- 6
- 29
- 53
-
2there is no Main() or other starting point, you are configuring services and you can call them from outside – Kamil Budziewski Jul 07 '13 at 14:08
-
Are you mean that I can't use services to host some logic except communication? – Arman Hayots Jul 07 '13 at 14:10
-
2You can store logic, but they are stateless http://stackoverflow.com/a/6050685/1714342 – Kamil Budziewski Jul 07 '13 at 14:16
-
Thanks for answer. So, I'm now trying classic static initializer-core pair. Maybe it will work now, I've used it two years ago with WCF Domain for simple chatting engine. – Arman Hayots Jul 07 '13 at 14:21
1 Answers
0
Put the logic in the static constructor of the Service class. If Service is IService1, put it in
static Service1() {
}
It will be called only once one service start.

iefpw
- 6,816
- 15
- 55
- 79