SilverlightPortal and Https

SilverlightPortal and Https

Old forum URL: forums.lhotka.net/forums/t/12794.aspx


cjherasmus posted on Wednesday, November 05, 2014

I need to run my existing SL csla application over https. I've setup the configuration in the files attached but still getting "The provided uri scheme 'https' is invalid; expected 'http'.

Server is windows 2003 with IIS 6.0 which is configured correct for ssl.

I've gone through all related posts here but I think I need a pair of fresh eyes on this one please.

JonnyBee replied on Wednesday, November 05, 2014

Hi,

Have you tried to declare binding in code?

Csla.ApplicationContext.DataPortalProxy = typeof(Csla.DataPortalClient.WcfProxy).AssemblyQualifiedName;
Csla.ApplicationContext.DataPortalUrlString = "http://localhost:1993/WcfPortal.svc"// Set to your URL 
Csla.DataPortalClient.WcfProxy.DefaultBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
{
    MaxBufferSize = int.MaxValue,
    MaxReceivedMessageSize = int.MaxValue,
    ReceiveTimeout = TimeSpan.FromMinutes(2),
    SendTimeout = TimeSpan.FromMinutes(2),
    OpenTimeout = TimeSpan.FromMinutes(2),
};

cjherasmus replied on Thursday, November 06, 2014

Hi,

I thought you couldn't assign to the Csla.ApplicationContext.DataPortalProxy, but I'll have a look at it.

Thanks

cjherasmus replied on Thursday, November 06, 2014

Yes, as expected, I can't assign a value to Csla.ApplicationContext.DataPortalProxy, it can only return a value.

skagen00 replied on Thursday, November 06, 2014

So please understand I think we have some extra redundancy here / I just am not entirely versed in this and once we got it fully working nicely, I was happy with it.  Good luck.

We use pretty close to the latest... in our app startup of the SL app:

            Csla.DataPortal.ProxyTypeName = typeof([ourprojectnamespace].Compression.CompressedProxy).AssemblyQualifiedName;
            Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
            Csla.DataPortalClient.WcfProxy.DefaultEndPoint = WcfPortalEndPointName;

WcfPortalEndPointName:

        /// <summary>
        /// Gets the configuration name of the endpoint to use for the WCF portal.
        /// </summary>
        /// <remarks>
        /// The name is a function of the host URL scheme (e.g. either http or https).
        /// </remarks>
        public static string WcfPortalEndPointName
        {
            get
            {
                return (Application.Current.Host.Source.Scheme.Equals("http", StringComparison.InvariantCultureIgnoreCase) ? "DefaultWcfPortalEndpoint" : "SecureWcfPortalEndpoint");
            }
        }

In our ServiceReferences.ClientConfig we have, within the serviceModel/bindings/basichttpbinding node:

                  <binding name="DefaultWcfPortalBinding" maxBufferSize="2147483647"
                           closeTimeout="00:05:00"
                          openTimeout="00:05:00"
                          receiveTimeout="00:10:00"
                          sendTimeout="00:05:00"
                       maxReceivedMessageSize="2147483647">
                       <security mode="None" />
                  </binding>
                  <binding name="SecureWcfPortalBinding" maxBufferSize="2147483647"
                           closeTimeout="00:05:00"
                          openTimeout="00:05:00"
                          receiveTimeout="00:10:00"
                          sendTimeout="00:05:00"
                       maxReceivedMessageSize="2147483647">
                       <security mode="Transport" />
                  </binding> 

...and within the client node:

             <endpoint address="http://OURSITENAME/SL/CompressedWcfPortal.svc"
                  binding="basicHttpBinding" bindingConfiguration="DefaultWcfPortalBinding"
                  contract="WcfPortal.IWcfPortal" name="DefaultWcfPortalEndpoint" />
             <endpoint address="https://OURSITENAME/SL/CompressedWcfPortal.svc"
                  binding="basicHttpBinding" bindingConfiguration="SecureWcfPortalBinding"
                  contract="WcfPortal.IWcfPortal" name="SecureWcfPortalEndpoint" />

We do have in our override for GetProxy (we used a compressed proxy) the following:

        protected override Csla.WcfPortal.WcfPortalClient GetProxy()
        {

            if (!String.IsNullOrEmpty(EndPoint))
            {
                var serviceAddress = string.Format("{0}://{1}/sl/compressedwcfportal.svc", Application.Current.Host.Source.Scheme, Application.Current.Host.Source.Host);
                var client = new Csla.WcfPortal.WcfPortalClient(EndPoint, serviceAddress);

                return client;
            }

            return base.GetProxy();
        }

cjherasmus replied on Friday, November 07, 2014

May I ask, what is the purpose/reason for including timeouts in the binding, either in the ClientConfig or in code as Jonny suggested?

JonnyBee replied on Friday, November 07, 2014

Hi,

The default timeouts are: 

Timeout Property

Default Value

OpenTimeout

1 minute

CloseTimeout

1 minute

SendTimeout

1 minute

ReceiveTimeout

10 minutes

se: http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.binding(v=vs.110).aspx  

So you either accept that or you specify your preferred setting. 

cjherasmus replied on Wednesday, November 12, 2014

Everything working now - solution was a combination of JonnyBee's and Skagen00's suggestions. Have a look at https://www.dwa.gov.za/chart with username "person" and password "Password?" When opened click or double-click on "Monitoring Programmes". Could be a bit slowish in IE.

Copyright (c) Marimer LLC