c# - Running WCF Windows Service as InstanceContextMode.PerCall -
I have a WCF service that is configured to run as a window service but only if it works only If I select Can anyone explain to me if I have the the context set as a window service to run the WCF service and why is it so? Public class catering sss service: iCTing sSTS service Update: Hosting code You are creating a single object and sending it to the Singleton Constructor If you want PerCall (or Percent or Singleton), you should type the If you have not forgotten the exception, then the runtime has told you what the problem is. Apply some reasonable error management to future problems. from InstanceContextMode to
single . When I change it to be
PerCall and restore the service, it can not be accessed.
[Service Provider (Instance ContactMode = Instant ContaxModePierCall) Strong>
private icing SSTS service _cateringSSTService; Private service_serviceHost; Personal Work _ Execution Task; Public Catering SSTServer () {} Public Zero Start () {_executionTask = New Work (Manager Startup); _executionTask.Start (); } Private Zero Manager Startup () {try {_cateringSSTService = New Catering SSTService ()); _serviceHost = New service host (_cateringSSTService); _serviceHost.Open (); } Catch (Exception) {}} Pause Public Null () {if (_serviceHost! = Null & amp; _serviceHost.State! = CommunicationState.Closed) {_serviceHost.Close (); }} Hold (exception) {throw; }}
ServiceHost . How is this service host supposed to create a new object every call? It can not work
ServiceHost constructor of your class There is a need to pass so that it can create new installations of this kind on runtime
_serviceHost = New service host (type forming (STS service));
Comments
Post a Comment