ClogService endpoint address

May 19, 2009 at 6:56 PM

Hi Daniel,

The silverlight app i'm working on will be installed on different servers. Is there any other way to configure the Clog Service endpoint address than  in the ServiceReferences.ClientConfig file ??
I do not want to compile a version for each of my client, each time I release new versions !
If not, can you tell me how to achieve that by modifying your code. I'm in a hurry and can't wait for a new version of Clog. Hope you understand !

Thak you,
-jeff.

Coordinator
May 19, 2009 at 8:41 PM
Edited May 19, 2009 at 8:42 PM

Hi Jeff,

In the last release I added a default binding that will attempt to resolve the WCF service automatically if none is configured.

This is done like so:

        IClogService GetClogService()
        {
            if (!clogServiceConfigFailed)
            {
                try
                {
                    var clogService = ChannelManagerSingleton.Instance.GetChannel<IClogService>();
                    return clogService;
                }
                catch (Exception ex)
                {
                    clogServiceConfigFailed = true;
                    OnInternalMessage(
                        new InternalMessageEventArgs(
                            "Unable to use WCF config for channel. Using default configuration. This may be acceptable if no end point has been defined.",
                            ex));
                }
                catch
                {
                    clogServiceConfigFailed = true;
                }
            }
            var result = new ClogServiceClient(new ClogBasicHttpBinding(),
                new EndpointAddress(new Uri(HtmlPage.Document.DocumentUri, "ClogService.svc")));

            return result;
        }

 

That excerpt is from DanielVaughan.Logging.Log in the SilverlightLogging project.

 

I wonder if this will see you through until I have time to improve things.

 

Cheers,

Daniel

 

May 20, 2009 at 7:55 AM
Edited May 20, 2009 at 8:10 AM

Hi Daniel,

First, thank you very much for your quick answer.
With your post, I realized that I don't have the latest version of Clog ! I'm still with 1.6 ! I'm going to upgrade right away.
If I understand the code excerpt correctly and let say my app is hosted at http://jeffe/CBS.CPBBMO.Web/ then the last statement (var result = new ClogServiceClient....) will attempt to create an EndPointAddress with new Uri pointing to http://jeffe/CBS.CPBBMO.Web/ClogService.svc
Is that assumption correct ? If yes, then you solved my problem and made my day ! :)

Keep up your excellent job !

Thanks,
-jeff.

[EDIT]
I dowloaded and compiled the latest bits and find out that you've changed the namespace for Clog. I've checked the v1.7 release notes and saw that you've changed the config stuff. Can you please give me quick advises on the "traps" I should not fall into when going from 1.6 to 1.8 ! Thank you.

Coordinator
May 20, 2009 at 8:12 AM

Hi Jeff,

Yes, that's the idea. :)

Let me know if you have any problems with that feature.

Cheers,

Daniel

Aug 24, 2009 at 9:30 AM
Edited Aug 24, 2009 at 12:35 PM

Hi Daniel,

Your project is great, but I think that creating CLogService using HtmlPage.Document.DocumentUri is not very flexible. Won't it be better to create callback function. Or a property for endpoint URL?

Thanks for Your answer.

Karel

Coordinator
Aug 24, 2009 at 6:04 PM

Hi Karel,

Would you point me to the code that you are refering to please.

Cheers,

Daniel

Aug 24, 2009 at 7:38 PM

It is the code from your first reply in this thread (the code of the private method GetCLogService). You might create a factory class that can be configured in app.config (web.config) file...

Coordinator
Aug 24, 2009 at 8:03 PM

No, you’re right, it’s not flexible. It’s merely meant to cater for the most common scenario where the WCF service config is missing. I could add an extensibility point if it’s wanted. Is it something you’re really seeking?

Aug 25, 2009 at 6:11 AM

Yes, it is. That will be great. Thanks for your time!