WinRT MobilePortal to secured endpoint

WinRT MobilePortal to secured endpoint

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


TSF posted on Monday, June 23, 2014

I'm trying to have my WinRT app connect securely to a remote data portal over https, for obvious reasons. Up till now I've been testing internally without SSL, but when I start to test using a secured address I get the following error:

The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via Csla.DataPortalClient.WcfProxy.<Fetch>d__8.MoveNext():0

I'm assuming this is because my client isn't configured to use the same wcf bindings the server uses. This wouldn't be a problem for .NET because I'd add those settings in the config file, or in the clientconfig in a SL app. How do I set the WCF bindings correctly within a WinRT app?

I recall this recent thread with this response by Rocky: http://forums.lhotka.net/forums/p/11201/57463.aspx#57463. It somewhat speaks to issues with Universal apps not being able to do this, but I'm not using building a Universal app. Is configuring the WCF bindings in the app.xaml.cs a possibility? Hopefully I'm not forced into using the BrokeredProxy model. Thanks.

TSF replied on Monday, June 23, 2014

I didn't realize you could still communicate securely with basicHttpBinding (over SSL). Perhaps I just need to make sure the settings on the client (in app.xaml.cs) match what is on the server??

Are there a recommended binding settings to use for this scenario? For example:

        <binding name="basicHttpBinding_IWcfPortal" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
         <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="Certificate" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>

RockfordLhotka replied on Monday, June 23, 2014

You need to create a subclass of WcfProxy so you can override the method where the actual WCF proxy is created. That is where you would configure the WCF client to match the server configuration.

TSF replied on Tuesday, June 24, 2014

Thanks. And to clarify, I was originally attempting to use WsHttpBinding, which I didn't realize isn't available in WinRT.

Copyright (c) Marimer LLC