Print Page | Close Window

how do ideablade config the clients?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3733
Printed Date: 13-Apr-2026 at 7:07pm


Topic: how do ideablade config the clients?
Posted By: pponzano
Subject: how do ideablade config the clients?
Date Posted: 22-Oct-2012 at 2:05am
Hello,
I've switched from http to https and I've noticed that ideablade automatically adopted the transport layer... for my sercive (wcf) I have to specify the binding as

     Uri uri = new Uri(Application.Current.Host.Source, "../Services/Authentication.svc");

            BasicHttpBinding binding = new BasicHttpBinding();
            EndpointAddress ep = new EndpointAddress(uri);

            service = new ServiceAuthentication.AuthenticationClient(binding, ep);

...is there a simpler way that permits me to have it dinamically created one?

I don't want to use the serviceclient.config since it has the address fixed in the configuration

   <endpoint address="http://localhost/xxxClient/Services/Authentication.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAuthentication"
        contract="ServiceAuthentication.IAuthentication" name="BasicHttpBinding_IAuthentication" />

Thanks



Replies:
Posted By: sbelini
Date Posted: 22-Oct-2012 at 8:52am
If you don't want to use the config file, you can use ServiceProxyEvents to do it in code.
You'll find more details at http://drc.ideablade.com/xwiki/bin/view/Documentation/deploy-advanced-configuration - http://drc.ideablade.com/xwiki/bin/view/Documentation/deploy-advanced-configuration and http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-client-configuration - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-client-configuration .


Posted By: kimj
Date Posted: 22-Oct-2012 at 9:35am
The DevForce services, EntityService.svc and EntityServer.svc, build up a CustomBinding, using the protocol scheme from the URI to determine whether SSL is used. 
 
Basically what you're doing, but with the added check of the uri.Scheme, something like this:
 
Uri uri = new Uri(Application.Current.Host.Source, "../Services/Authentication.svc");
if (uri.Scheme == "http")
    BasicHttpBinding binding = new BasicHttpBinding();
else if (uri.Scheme == "https")
    BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
EndpointAddress ep = new EndpointAddress(uri);
service = new ServiceAuthentication.AuthenticationClient(binding, ep);
 



Print Page | Close Window