What hosting method can be used for a WCF service to prevent multiple service start?

StackOverflow https://stackoverflow.com/questions/7225108

  •  15-01-2021
  •  | 
  •  

Pergunta

I'm developing a Client-Server Application which moderate Wireless Access Point.

I want change Server Application to a service with WCF. What hosting method can be used? Service should run one time.

I know i can host as windows service but It's to hard for me! If I use self-hosting with a Console Application (for example) ,this program ran 2 times,then two service will be hosted? (I know we can prevent an application from multiple running,but we should not prevent application from multiple running, we just prevent service from multiple hosting)

Foi útil?

Solução

In Self-hosting you can't have two applications on the same computer serve the same URL - so if your Console application with self-hosting is started twice and uses the same URL for WCF Server then the second start will throw an exception that the URL is already in use practically preventing your WCF Service from being served by two applications at the same time...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top