Search code examples
c#wcfsslload-balancingf5

WCF service web.config tweaks to change the generated wdl


My wcf service follows following structure of load balancing:

public (https) -> F5 LB (http) -> node1/node2.

i am exposing services on http scheme and F5 LB takes care of ssl offloading. since my service is exposed as http, the generated wsdl through F5 LB contains http based url as follows:

my LB service URL:

https://myservice.mydomain.com/service1.svc

and the generated service page is :

MyService Service

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:    

svcutil.exe http://myservice.mydomain.com/service1.svc?wsdl

You can also access the service description as a single file:

http://myservice.mydomain.com/service1.svc?singleWsdl

as you notice the generated page has http url exposed from app nodes. since F5 LB exposes service as https, its not allowing the above http url and the request from client is bouncing.

now, can we tweak my service web.config to expose the service on http scheme but have wsdl points to https url so that the url from generated above wsdl from F5 LB too https and client will work on https and request from LB will come to service on http that my service handle?


Solution

  • Without fully understanding your configuration/environment, I’ll suggest a few options that may help you resolve the issue:

    • Provide both http and https base addresses in your service configuration and enable metadata via https only ''
    • Implement a separate mex endpoint (rather than using the serviceMetadata), which allows more control of the metadata endpoint (i.e. different address and/or listenUri)
    • Use the System.ServiceModel.Description.IWsdlExportExtension to control the rendered service metadata

    References:
    What was the difference between WSDL & Mex Endpoint in WCF
    http://blogs.msdn.com/b/saurabs/archive/2012/04/27/http-get-v-s-mex-end-point.aspx
    http://msdn.microsoft.com/en-us/library/aa717040.aspx