How I can comment element of config file during the installing?
I.e. I install WCF service to IIS. If IIS does not have https protocol binding I need to comment https endpoints in Web.config.
Else do not comment this endpoint.
<service name="MyServer.MyDataAccessRESTService" behaviorConfiguration="MyServer.MyDataAccessRESTServiceBehavior">
<endpoint binding="webHttpBinding" contract="MyServer.IMyDataAccessRESTService"
bindingConfiguration="webHttpBinding0" behaviorConfiguration="MyDataAccessRESTServiceBehavior"
address="http://localhost/svc2Web/svc2rest.svc"></endpoint>
<endpoint binding="webHttpBinding" contract="MyServer.IMyDataAccessRESTService"
bindingConfiguration="webHttpBinding1" behaviorConfiguration="MyDataAccessRESTServiceBehavior"
address="https://localhost/svc2Web/svc2rest.svc"></endpoint>
</service>
I would do this the other way around. Let the default version of web.config omit the HTTPS endpoint. In case HTTPS is on in IIS, add a new element to web.config using XmlConfig capabilities. You can find the sample of how to do this here and here.