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

  • Home
  • SEARCH
  • 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 7797423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:40:43+00:00 2026-06-01T23:40:43+00:00

I have a Silverlight 4 application that I want to double as a Kiosk

  • 0

I have a Silverlight 4 application that I want to double as a Kiosk application. It has to be full screen, touch-enabled, and most importantly have full trust. I was thinking of doing this using a WPF application to host the Silverlight XAP. I am aware of the WPF/XNA SilverlightViewport, but it seems that this solution doesn’t provide communication between WPF and Silverlight.

This would really save me a whole lot of time. I would not have to maintain two distinct applications that do the exact same thing, and I wouldn’t have to deploy to hundreds of kiosks every-time I make a change.

  • 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-06-01T23:40:45+00:00Added an answer on June 1, 2026 at 11:40 pm

    I know it’s an old question, but I do have a solution.

    I do this exact scenario. I host a Silverlight app in a WPF host. I use self hosted WCF to deliver duplex net tcp services. To do this, you have to also have a HTTP hosted clientaccesspolicy.xml, which I also self host from the same service.

    I hope I can explain enough to get the ball rolling. I’ll include some samples where I can, however due to the project I can’t share everything.

    Firstly, some considerations:
    1) net tcp is not secure between Silverlight and WPF as Silverlight (as of version 4 – just testing version 5) cannot do the secure connections, so you have to roll your own encryption if you are to use this.

    2) There are two methods to doing duplex WCF, one is with HTTP. The HTTP method ‘polls’ the service to see if any commands are coming from the host for the client. This inherently makes it much slower than net tcp. The other is with net tcp (as stated earlier). Only http method supports encryption out of the box.

    3) When you host the Silverlight app in the WPF host, when you start to debug, you will not be able to debug your Silverlight app, as the debugger will not connect to the (as it sees it) external Silverlight application, only the WPF. To get around this, you have to ‘activate’ the attachment to the Silverlight application when you start the WPF host.

    Now for the code:

    Remote Service Interface:

    using System.ServiceModel;
    
    namespace RemoteService
    {
        [ServiceContract(CallbackContract = typeof(IRemoteCallbackService))]
        public interface IRemoteService
        {
            [OperationContract]
            void TestCallback();
    
            // TODO: Add your service operations here
        }
    
        [ServiceContract]
        public interface IRemoteCallbackService
        {
            [OperationContract(IsOneWay = true)]
            void OnTestCallbackComplete();
    
            // TODO: Add your service operations here
        }
    }
    

    Your policy listener interface:

    using System.IO;
    using System.ServiceModel;
    using System.ServiceModel.Web;
    
    namespace RemoteService
    {
        [ServiceContract]
        public interface IPolicyRetriever
        {
            [OperationContract, WebGet(UriTemplate = "/clientaccesspolicy.xml")]
            Stream GetSilverlightPolicy();
    
            [OperationContract, WebGet(UriTemplate = "/crossdomain.xml")]
            Stream GetFlashPolicy();
        }
    }
    

    The actual service implementation:

    using System.Text;
    
    namespace RemoteService
    {
        public class RemoteService : IRemoteService, IPolicyRetriever
        {
            IRemoteCallbackService client = null;
    
            public void TestCallback()
            {
                client = OperationContext.Current.GetCallbackChannel<IRemoteCallbackService>();
                client.OnTestCallbackComplete();
            }
    
            #region Cross Domain Policy Implementation
    
            private Stream StringToStream(string result)
            {
                WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml";
                return new MemoryStream(Encoding.UTF8.GetBytes(result));
            }
    
            //<grant-to>
            //<resource path="/" include-subpaths="true"/>
            //<socket-resource port="4502-4534" protocol="tcp" />
            //</grant-to>
    
            Stream IPolicyRetriever.GetSilverlightPolicy()
            {
                string result = @"<?xml version=""1.0"" encoding=""utf-8""?><access-policy><cross-domain-access><policy><allow-from http-request-headers=""*""><domain uri=""*""/></allow-from><grant-to><resource path=""/"" include-subpaths=""true""/><socket-resource port=""4502-4534"" protocol=""tcp"" /></grant-to></policy></cross-domain-access></access-policy>";
                return StringToStream(result);
            }
    
            Stream IPolicyRetriever.GetFlashPolicy()
            {
                string result = @"<?xml version=""1.0""?><!DOCTYPE cross-domain-policy SYSTEM ""http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd""><cross-domain-policy><allow-access-from domain=""*"" /></cross-domain-policy>";
                return StringToStream(result);
            }
    
            #endregion Cross Domain Policy Implementation
        }
    }
    

    The above should be in separate classes in one dll project, and then referenced by your WPF host.

    And to host it in a console app (you need to convert this to WPF):

    using System;
    using System.ServiceModel;
    using System.ServiceModel.Description;
    using LocalService;
    using RemoteService;
    
    namespace Host
    {
        internal class Program
        {
            /// <summary>
            /// Main host entry point, this starts our listeners
            /// </summary>
            /// <param name="args">The args.</param>
            private static void Main(string[] args)
            {
                // Start our listeners
                StartListeners(80, 4504, true);
            }
    
            /// <summary>
            /// Starts the listeners.
            /// </summary>
            private static void StartListeners(int HttpPort = 80, int NetTcpPort = 4504, bool StartRemoteService = true)
            {
                Console.WriteLine("Starting Policy Listener");
    
                string policyaddress = "http://" + Environment.MachineName + ":" + HttpPort.ToString();
                string locallistener = "net.tcp://" + Environment.MachineName + ":" + NetTcpPort.ToString();
    
                // Start our policy listener and (if required) our remote http service:
                using (System.ServiceModel.ServiceHost policyandremoteservicehost = new System.ServiceModel.ServiceHost(typeof(RemoteService.RemoteService), new Uri(policyaddress)))
                {
                    policyandremoteservicehost.AddServiceEndpoint(typeof(IPolicyRetriever), new System.ServiceModel.WebHttpBinding(), "").Behaviors.Add(new WebHttpBehavior());
    
                    // if we are to start our remote service here too, then add that endpoint in:
                    if (StartRemoteService)
                    {
                        policyandremoteservicehost.AddServiceEndpoint(typeof(IRemoteService), new System.ServiceModel.PollingDuplexHttpBinding(), "RemoteService");
                    }
    
                    ServiceMetadataBehavior psmb = new ServiceMetadataBehavior();
                    psmb.HttpGetEnabled = true;
                    psmb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                    policyandremoteservicehost.Description.Behaviors.Add(psmb);
                    policyandremoteservicehost.Open();
    
    
                    Console.WriteLine("WCF Host Running...");
                    Console.WriteLine("Press <enter> to shutdown");
                    Console.ReadLine();
                    Console.WriteLine("Closing connections, please wait");
                    policyandremoteservicehost.Close();
                    Console.WriteLine("Closed policy and remote services");
                }
            }
        }
    }
    

    Which should give you something to work on. The startremoteservice bool can be used to just make it a policy file listener, which then will allow you to connect to a remote service without that remote service having to host a policy file.

    Remember, that Silverlight can only connect to HTTP/HTTPS ports, and TCP ports within the range of 4502-4534. The included clientaccesspolicy.xml is quite unrestricted.

    I hope this is of use to someone 🙂 .

    Feel free to ask me questions if you want, I’ll keep a look out.

    A couple of points of note: You can serve your hosted xap from this solution, and therefore do not require IIS. You can also run your Silverlight xap out of browser and still use these services.

    The debugging answer is here: Debugging Silverlight hosted in WPF

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

Sidebar

Related Questions

I have a silverlight application that contains Bing map. I want when the user
I have a Silverlight application that uses Kit3D and I want to convert it
I have a Silverlight application that will run out of the browser. I want
I have a Silverlight RIA application that uses Forms authentication. We want to pass
i have a silverlight application (SL3) that is enabled for use out of the
We have a WPF application that we want to convert to Silverlight. I understand
I have a Silverlight 4 application that I want to secure. Does Silverlight 4
We have a Silverlight application that uses WCF Data Services. We want to add
I have a Silverlight application that has a DataGrid. I need to print the
I have written a WPF application that I want to port to Silverlight 2.

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.