Problem overriding DataPortalUrl property at runtime

Problem overriding DataPortalUrl property at runtime

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


murtaza.tinwala posted on Monday, July 15, 2013

Hi,

I have a silverlight application which connects to a WCF service using HTTPS using CSLA framework.  As usual the service references are stored in ServiceReferences.clientconfig.  That is a problem and we have to hack .xap file when we deploy on production.  What tried to set endpoint address at runtime but CSLA throws

Normal 0 false false false EN-NZ ZH-CN X-NONE "The provided URI scheme 'https' is invalid; expected 'http'"

exception.  Please note that this exception does not occur when endpoint address is picked from client configuration file.  So that means CSLA data portal is doing something when we override DataPortalUrl property.  This does not look like WCF configuration or HTTPS issue.


//    base.DataPortalUrl = dynamicURL;//build dynamic url here

If someone has attempted this earlier, please help me.

Regards,

Murtaza

 

JonnyBee replied on Tuesday, July 16, 2013

,

Have you tried to set the

ApplicationContext.DataPortalUrlString in code?

    public static string DataPortalUrlString
    {
      get
      {
        return _dataPortalUrl;
      }
      set
      {
        _dataPortalUrl = value;
      }
    }

    public static Uri DataPortalUrl     {       get { return new Uri(DataPortalUrlString); }     }

 

murtaza.tinwala replied on Tuesday, July 16, 2013

Hi Jonny,

 

Thanks for posting.  But I cannot find ApplicationContext object?  Is that some specific CSLA entity?  What namespace do I need to import?

 

Murtaza

Peran replied on Wednesday, July 17, 2013

Are you also updating the binding to support https?

 

            var binding = new BasicHttpBinding();

            binding.MaxBufferSize = int.MaxValue;

            binding.MaxReceivedMessageSize = int.MaxValue;

            binding.ReceiveTimeout = TimeSpan.FromMinutes(1);

            binding.SendTimeout = TimeSpan.FromMinutes(1);

            binding.OpenTimeout = TimeSpan.FromMinutes(1);

            binding.CloseTimeout = TimeSpan.FromMinutes(1);

 

            // allow https endpoint url

            binding.Security.Mode = BasicHttpSecurityMode.Transport;

 

            Csla.DataPortalClient.WcfProxy.DefaultUrl = "https://myweb.com/WcfPortal.svc"

            Csla.DataPortalClient.WcfProxy.DefaultBinding = binding;

murtaza.tinwala replied on Friday, July 19, 2013

Hi Peran,

Is it necessary to set Binding if we are setting HTTPS url?  Can CSLA pick up binding information from Silverlight Servicereferences.clientconfig file?  Because we are not setting any binding properties in code - we specify binding properties only in silverlight configuration file.  This works fine with HTTP.  I am wondering why it does not work with HTTPS.  Please note that mine is a Silverlight application.

 

Regards,

Murtaza

Peran replied on Tuesday, July 23, 2013

I have not tried part code/part .clientconfig before.  Do you get the same problem if you set the Binding in code?

 

Regards

Peran

Copyright (c) Marimer LLC