Remote Service Trace Listener using SSL

Topics: Silverlight Integration Pack
May 15, 2013 at 7:32 PM
Well I believe I’m not the only one having this issue and there may be already a solution out there, but I could not find it.
I have Silverlight application and we use Enterprise Library 5 for Silverlight for logging Silverlight exceptions to the Server using “Remote Service Trace Listener”
The WCF logging service is configured on the server to use custom binding using <httpTransport> element, So the binding in client side configuration file ( ServiceReference.ClientConfig) is also using httpTransport.
Recently we decided that in production all the communication from Client to server should be over SSL. In all other environments ( QA, DEV , UAT) it should be over http as usual. So in production I setup the logging service binding to use httpsTransport. However on client side this configuration is in ServiceReference.ClientConfig which in embedded in XAP file. How do I dynamically change the client side binding to use httpTransport or httpsTransport
Editor
May 16, 2013 at 8:36 AM
If you want to have a dynamic endpoint in Silverlight for the Remote Service Trace Listener then there are two places that you could hook into that:
  • Silverlight Logging Configuration
  • Custom LoggingServiceFactory
In ServiceReference.ClientConfig you can configure two separate bindings/client endpoints to correspond to HTTP/HTTPS. Then in the Silverlight Logging Configuration the name of the correct LoggingServiceFactory endpoint could be specified. If you are reading the Silverlight Logging Configuration from the server you could have the server return the proper logging configuration. If you have the Silverlight Logging Configuration embedded as a file in the xap you could create 2 separate logging config files and determine which to read. Or if you have the Silverlight Logging Configuration in the xap as a string you could modify the string to use the correct LoggingServiceFactory endpoint name.

Another approach would be to create a custom LoggingServiceFactory at runtime and programmatically configure the Silverlight app with the correct settings. See this post: http://entlib.codeplex.com/discussions/279341 for an example of how to do that. You could have the Custom LoggingServiceFactory use HttpTransportBindingElement or HttpsTransportBindingElement along with the proper endpoint (http or https).

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
May 16, 2013 at 9:39 PM
Thanks, thats is exactly what i was looking for