Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3953428
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:58:25+00:00 2026-05-20T01:58:25+00:00

Our Silverlight Application can run in both http and https (SSL, using Transport Security)

  • 0

Our Silverlight Application can run in both http and https (SSL, using Transport Security) Mode. In our ServiceReferences.ClientConfig file we simply configured our Service Endpoint this way:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="DefaultEndpoint"
                 maxBufferSize="2147483647"
                 maxReceivedMessageSize="2147483647">
          <security mode="None" />
          <!-- Enable for SSL: mode="Transport" -->
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="/services/DefaultService.svc"
                binding="basicHttpBinding"
                bindingConfiguration="DefaultEndpoint"
                contract="OurNamespace.IOurContractAsync"
                name="DefaultEndpoint" />
    </client>
  </system.serviceModel>
</configuration>

The configured Endpoint can be accessed in both Modes. It simply depends in which context the XAP file was loaded: From http://example.com/slpage.html or https://example.com/slpage.html. Unfortunately, we have to manually switch the Security Mode setting between “None” and “Transport”. Everything else would already work as desired. When Security Mode is “None” and we access via https, we get an Exception that “..https was provided but http was expected…” and vice versa. Any chance to let Silverlight automatically decide which Security Mode should be used? What is the simplest solution to this problem?

Thanks in advance

Thomas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:58:26+00:00Added an answer on May 20, 2026 at 1:58 am

    we finally ended up with the following solution (not exactly what Valentin suggested, but +1 for help!):

    The ServiceReferences.ClientConfig contains both binding and endpoint configurations like this:

    <configuration>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="DefaultBinding"
                     maxBufferSize="2147483647"
                     maxReceivedMessageSize="2147483647">
              <security mode="None" />
            </binding>
          </basicHttpBinding>
          <customBinding>
            <binding name="SecureBinding">
              <textMessageEncoding messageVersion="Soap12WSAddressing10" />
              <httpsTransport maxBufferSize="2147483647"
                              maxReceivedMessageSize="2147483647" />
            </binding>
          </customBinding>
        </bindings>
        <client>
          <endpoint address="/services/DefaultService.svc"
                    binding="basicHttpBinding"
                    bindingConfiguration="DefaultBinding"
                    contract="OurNamespace.IOurContractAsync"
                    name="DefaultEndpoint" />
          <endpoint address="/services/DefaultService.svc"
                    binding="customBinding"
                    bindingConfiguration="SecureBinding"
                    contract="OurNamespace.IOurContractAsync"
                    name="SecureEndpoint" />
        </client>
      </system.serviceModel>
    </configuration>
    

    On initialization, we read the App.Current.Host.Source.Scheme Property. The Service client is generated by the ChannelFactory, the code is similar to this snippet:

    protected string EndpointName {
      get {
        return (App.Current.Host.Source.Scheme == "https") ?
          "SecureEndpoint" : "DefaultEndpoint";
      }
    }
    
    protected IOurContractAsync CreateInterface() {
      var channelFactory = ChannelFactory<IOurContractAsync>(EndpointName);
      return channelFactory.CreateChannel();
    }
    

    Hope this helps!

    Best regards,
    Thomas

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Silverlight application using the RichTextBox as a rich text editor for
Im currently developing a Silverlight application that connects to an old webservice. Our old
I have a Silverlight 4.0 (ASP.Net 4.0) application on our website for our customers
I am wondering any efficient way to hide our Silverlight code. I know there
Our application is interfacing with a lot of web services these days. We have
Our security manager dynamically inserts a bit of javascript at the top of every
We are just getting into Silverlight development at my workplace. Somehow two of our
I'm working on building a Silverlight application whereas we want to be able to
I built a web application containing a WCF service contract and a Silverlight control
I have a Silverlight application communicating with the server side through WCF services. Initially

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.