سؤال

I'd like to use a web service (created in my main thanks to new ServiceHost(typeof(..)) ) and I would like to retrieve data received by my server to process it in my main.

I've begun with a simple event handler but it is impossible because I have to create an instance instead of using typeof.

Is there another solution?

هل كانت مفيدة؟

المحلول

You can use a singleton WCF service. You need to decorate the service class with [ServiceBehavior] and specify InstanceContextMode.Single, and then you pass an instance of the service class to the ServiceHost constructor.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top