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 928887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:04:56+00:00 2026-05-15T20:04:56+00:00

Has anyone had any issues communicating between two Silverlight apps. When I try to

  • 0

Has anyone had any issues communicating between two Silverlight apps. When I try to send a message from one app, I get an error, “The message could not be delivered to receiver.” My code for sending is below. I’m using the similar code that is in the samples for implementing Windows Live ID in a Silverlight App. I have this working when I’m running locally, but when I post to the server, I’m getting the delivery error.

    #region Fields
    private readonly LocalMessageSender sender = new LocalMessageSender("LiveIdAuthentication");
    private int attempts = 0;
    private const int MAX_ATTEMPTS = 10;
    #endregion

    #region Constructors
    public MainPage()
    {
        InitializeComponent();

        this.sender.SendCompleted += new EventHandler<SendCompletedEventArgs>(Sender_SendCompleted);
        this.SendMessage("authenticated");
    }
    #endregion

    #region Event Handlers
    private void Sender_SendCompleted(object sender, SendCompletedEventArgs e)
    {
        if (e.Error != null)
        {
            if (attempts > MAX_ATTEMPTS)
            {
                MessageBox.Show(e.Error.Message);
                CloseWindow();
            }
            else
            {
                SendMessage("authenticated");
            }
        }
        else
        {
            attempts = 0;
            CloseWindow();
        }
    }
    #endregion

    #region Methods
    private void SendMessage(string message)
    {
        attempts++;
        this.sender.SendAsync(message);
    }

    private void CloseWindow()
    {
        HtmlPage.Window.Eval("window.open(\"about:blank\", \"_self\")");
        HtmlPage.Window.Eval("window.close()");
    }
    #endregion

Sorry about forgetting the receiver. This is mostly from the Live ID example.

        private readonly WindowsLiveIdAuthentication _service;
        private readonly AsyncCallback _asyncCallback;
        private readonly object _asyncState;
        private readonly LocalMessageReceiver _receiver = new LocalMessageReceiver("LiveIdAuthentication");
        private bool _isCompleted;
        private LoadUserResult _result;

        #region Constructors
        public LoginAsyncResult(WindowsLiveIdAuthentication service, AsyncCallback asyncCallback, object asyncState)
        {
            this._service = service;
            this._asyncCallback = asyncCallback;
            this._asyncState = asyncState;
            this._receiver.MessageReceived += this.LocalMessageReceived;
        }
        #endregion

        #region Properties
        public object AsyncState
        {
            get { return this._asyncState; }
        }

        public System.Threading.WaitHandle AsyncWaitHandle
        {
            get { throw new NotImplementedException(); }
        }

        public bool CompletedSynchronously
        {
            get { return false; }
        }

        public bool IsCompleted
        {
            get { return this._isCompleted; }
        }

        public LoadUserResult Result
        {
            get { return this._result; }
        }
        #endregion

        #region Methods
        public void Cancel()
        {
            if (!this._isCompleted)
            {
                this._isCompleted = true;
            }
        }

        public void Complete()
        {
            if (!this._isCompleted)
            {
                this._isCompleted = true;
                this._receiver.Dispose();

                Application.Current.RootVisual.Dispatcher.BeginInvoke(() =>
                {
                    if (this._asyncCallback != null)
                    {
                        this._asyncCallback(this);
                    }
                });
            }
        }
        #endregion

        #region Event Handlers
        public void HandleLoadCallback(IAsyncResult asyncResult)
        {
            this._result = this._service.EndLoadUser(asyncResult);
            if (!this._result.User.Identity.IsAuthenticated && !this._isCompleted && (this != asyncResult.AsyncState))
            {
                this._receiver.Listen();
            }
            else
            {
                this.Complete();
                if (Globals.CurrentUser == null)
                {
                    Globals.CurrentUser = _result.User as User;
                    Globals.SelectedDate = DateTime.Now;
                    (App.Current.RootVisual as MainPage).SetTheme(Globals.CurrentUser.CurrentTheme);
                    HtmlPage.Window.Navigate(new Uri("#UserHome", UriKind.Relative));
                }
            }
        }

        private void LocalMessageReceived(object sender, MessageReceivedEventArgs e)
        {
            this._service.BeginLoadUser(this.HandleLoadCallback, this);
        }
        #endregion

UPDATE:
OK, I found out that a RIA service call had failed, which resulted in not calling receiver.Listen(). So there wasn’t a receiver for the sender to send messages. I’m still working on the failed RIA service call, but that’s a different issue. I’ll mark this as answered.

  • 1 1 Answer
  • 1 View
  • 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-15T20:04:57+00:00Added an answer on May 15, 2026 at 8:04 pm

    Please also add the code for the receiver. That is a very important part of this. If the receiver doesn’t exist, for example, then it will fail.

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

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is not pretty but it works: rm -R $(ls… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer Yes. Override the base1 and base2 methods in Derived to… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer No, you can't. Unfortunately, UIEvent doesn't expose any public way… May 16, 2026 at 12:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

No related questions found

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.