This project is read-only.


Default Binding Fails On Second Try


I found the following code that allows us to get a default binding.
var result = new ClogServiceClient(new ClogBasicHttpBinding(), new EndpointAddress(new Uri(HtmlPage.Document.DocumentUri, "ClogService.svc")));
Altough it works fine when we try to get the configuration, the second time, when it writes to the log, it does it from a Service Callback (another thread) and it fails because the HtmlPage.Document can only be accessed from the UI Thread.
Closed Dec 2, 2009 at 4:55 PM by DanielVaughan
Patch applied to source located at


DanielVaughan wrote Oct 12, 2009 at 4:38 PM

For now please use a customized ServiceReference.ClientConfig.

wrote Oct 13, 2009 at 3:09 AM

mamadero wrote Oct 13, 2009 at 3:09 AM

That's my current workaround.


mamadero wrote Nov 18, 2009 at 5:38 AM


Is there any update about this?
I'm trying to use this library on a different project and in this case I can't afford to use a different ClientConfig, since we have a lot of different deployment environements that are currently inferred based on the host where the app was downloaded from.
What I'm doing is that I'm caching the Endpoint the first time and just use it on subsequence calls. I will be happy to submit a patch, but I don't want to branch the project :(


DanielVaughan wrote Nov 18, 2009 at 9:13 AM

If you have a patch then please submit it. I would be more than happy to integrate it.

In the future, once I release the Silverlight version of Calcium, I will be including the latest source for Clog in the Calcium repository. This is because of the shared VS projects.


mamadero wrote Nov 18, 2009 at 12:13 PM

That's great.

It's a simple change. I just added a field for the endpoint and I use that on following attempts. The first one is done on the UI Thread and followings don't have to access the HtmlPage object, thus avoiding the Cross Thread Exception. This is the whole GetClogService method. The change is at the end.

private static EndpointAddress fallBackEndpoint;
    IClogService GetClogService()
        if (!clogServiceConfigFailed)
                var clogService = ChannelManagerSingleton.Instance.GetChannel<IClogService>();
                return clogService;
            catch (Exception ex)
                clogServiceConfigFailed = true;
                    new InternalMessageEventArgs(
                        "Unable to use WCF config for channel. Using default configuration. This may be acceptable if no end point has been defined.",
            //              catch
            //              {
            //                  clogServiceConfigFailed = true;
            //              }

        if (fallBackEndpoint == null)
            fallBackEndpoint = new EndpointAddress(new Uri(HtmlPage.Document.DocumentUri, "ClogService.svc"));
        var result = new ClogServiceClient(new ClogBasicHttpBinding(),fallBackEndpoint);

        return result;

On another topic. What is Calcium?

DanielVaughan wrote Nov 18, 2009 at 1:28 PM

Thanks Miguel.

Info on Calcium can be found at


mamadero wrote Nov 19, 2009 at 12:29 AM


Thanks. I took a quick look at Calcium, it looks good. I think there're many gaps to close from where P&P left it.

wrote Dec 2, 2009 at 4:55 PM

wrote Feb 14, 2013 at 2:06 AM

wrote May 16, 2013 at 7:02 AM