Is it possible that some application will turn on/off web service that hosted by iis?
I wrote wcf web service and the host is IIS. But i want that this web service will be available only when some application ( that i writing ) is running.
Is it possible to have an ability to turn on/off this web service by my application ?
Yes, you can create separate application pool for your web services and start\stop it from your C# code (with enough permissions). There're plenty of ways to do it, I prefer that one:
var directoryEntry = new DirectoryEntry("IIS://YOURWEBSERVER/W3SVC/AppPools/WebServicesAppPool", USERNAME, PASSWORD); // stop the Application Pool directoryEntry.Invoke("Stop", null); // start the Application Pool directoryEntry.Invoke("Start", null);