When hosting in an IIS server, the WCF service and endpoints configuration are, by default, loaded from the
Web.config file. So, developers do not need to explicitly create and initiate the ServiceHost like we do in a self-hosting scenario. Sometimes, however, we still need to customize the service or endpoints through code. This recipe will use a custom metadata configuration case to demonstrate how to programmatically adjust service behaviors in an IIS-hosting scenario.
Here we will go through the steps of applying a customized
ServiceMetadataBehavior into an IIS-hosted WCF service:
We can simply create a new WCF service by adding ...