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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:39:19+00:00 2026-05-21T05:39:19+00:00

Please help…I’m going crazy….I have a wcf service that exists on a few different

  • 0

Please help…I’m going crazy….I have a wcf service that exists on a few different servers. I need to dynamically change the endpoint address on my silverlight client depending on the environment its in. I’m currently getting a very detailed 404 error (sarcasm) when I try to change the address through code or by manually updating the client config file.

However, when I right-click on the service reference and go to configure service on my client I can change the address and it works.

I have the following service.

<system.serviceModel>
 <bindings>
  <basicHttpBinding>
    <binding name="DrawingServiceBasicHttp">
      <readerQuotas maxStringContentLength="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>

<service behaviorConfiguration="md" name="My.DrawingService">
    <endpoint address="Services" 
              binding="basicHttpBinding" 
              bindingConfiguration="DrawingServiceBasicHttp"
              name="DrawingServiceEndPoint" 
              contract="MyServices.IDrawingService" />
    <endpoint address="mex" 
              binding="mexHttpBinding" 
              bindingConfiguration=""
              name="DrawingMex" 
              contract="IMetadataExchange" />
 <behaviors>
  <serviceBehaviors>
    <behavior name="md">
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

My client config

<bindings>
        <basicHttpBinding>
            <binding name="DrawingServiceEndPoint" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647">
                <security>
                    <transport>
                        <extendedProtectionPolicy policyEnforcement="Never" />
                    </transport>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://MyHostName/Services/DrawingService.svc/Services"
            binding="basicHttpBinding" bindingConfiguration="DrawingServiceEndPoint"
            contract="EvalDrawingService.IDrawingService" name="DrawingServiceEndPoint" />
    </client>

In Code trying to set the address:

EvalDrawingService.DrawingServiceClient client = new EvalDrawingService.DrawingServiceClient("DrawingServiceEndPoint", GetServiceAddress());

I have verified the address being spit out by GetServiceAddress() is there and that I can use the browser to verify it exists (not to mention I can connect to it using the wcftestclient).

The Exception:

{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. —> System.Net.WebException: The remote server returned an error: NotFound. —> System.Net.WebException: The remote server returned an error: NotFound.
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClass5.b_4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_1(Object sendState)
— End of inner exception stack trace —
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
— End of inner exception stack trace —
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase1.ChannelBase1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at EvaluaionAncillaryControl.EvalDrawingService.DrawingServiceClient.DrawingServiceClientChannel.EndGetEvalAreaDrawing(IAsyncResult result)
at EvaluaionAncillaryControl.EvalDrawingService.DrawingServiceClient.EvaluaionAncillaryControl.EvalDrawingService.IDrawingService.EndGetEvalAreaDrawing(IAsyncResult result)
at EvaluaionAncillaryControl.EvalDrawingService.DrawingServiceClient.OnEndGetEvalAreaDrawing(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}

  • 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-21T05:39:19+00:00Added an answer on May 21, 2026 at 5:39 am

    I found these which looks promising:

    http://omaralzabir.com/dynamically-set-wcf-endpoint-in-silverlight/

    http://blogs.artinsoft.net/mrojas/archive/2011/03/23/dynamically-change-wcf-endpoint.aspx

    Also, here’s some code from my server project where I can change the end point on the fly using channels. I haven’t tried it from Silverlight. it does work from the server side.

        /// <summary>
        /// This class contains utility methods related to invoking WCF services.
        /// http://msdn.microsoft.com/en-us/library/ms734681.aspx
        /// </summary>
        public static class ServiceInvoker
        {
            /// <summary>
            /// Alternative to the using statement to handle exceptions thrown by the Close method
            /// by calling the Abort method to ensure the transition to the Closed state.
            /// </summary>
            /// <param name="action">
            /// The action.
            /// </param>
            /// <typeparam name="TService">
            /// The service type.
            /// </typeparam>
            public static void UsingProxy<TService>(Action<TService> action)
                where TService : class, ICommunicationObject, IDisposable, new()
            {
                // create an instance of TService and invoke the action
                TService service = new TService();
                service.InvokeAction(action);
            }
            /// <summary>
            /// Alternative to the using statement to handle exceptions thrown by the Close method
            /// by calling the Abort method to ensure the transition to the Closed state.
            /// </summary>
            /// <param name="action">
            /// The action.
            /// </param>
            /// <typeparam name="TService">
            /// The service type.
            /// </typeparam>
            public static void UsingChannel<TService>(ChannelFactory<TService> channelFactory, Action<TService> action)
                where TService : class
            {
                // create an instance of TService and invoke the action
                TService service = channelFactory.CreateChannel();
                service.InvokeAction(action);
            }
            /// <summary>
            /// Alternative to the using statement to handle exceptions thrown by the Close method
            /// by calling the Abort method to ensure the transition to the Closed state.
            /// </summary>
            /// <param name="action">
            /// The action.
            /// </param>
            /// <typeparam name="TService">
            /// The service type.
            /// </typeparam>
            public static void UsingFactory<TService>(Action<TService> action)
                where TService : class
            {
                // TODO: cache the channel factory of TService
                ChannelFactory<TService> factory = new ChannelFactory<TService>("*");
                // create an instance of TService and invoke the action
                TService service = factory.CreateChannel();
                service.InvokeAction(action);
            }
            /// <summary>
            /// Invokes an action on a service then disposes the service channel.
            /// </summary>
            /// <typeparam name="TService">
            /// The service type.
            /// </typeparam>
            /// <param name="service">
            /// The service.
            /// </param>
            /// <param name="action">
            /// The action.
            /// </param>
            private static void InvokeAction<TService>(this TService service, Action<TService> action)
                where TService : class
            {
                try
                {
                    // invoke action with service as its parameter
                    action(service);
                }
                catch (Exception)
                {
                    // todo: add logging here
                    throw;
                }
                finally
                {
                    // always close or abort the service channel
                    ((ICommunicationObject)service).CloseOrAbort();
                }
            }
        }
    

    Here’s how I use it:

    ServiceInvoker.UsingChannel<IMyProxy>(new ChannelFactory<IMyProxy>(new NetTcpBinding(), myServer.EndPointReference.Address), server =>
                {
                    result = server.CallAMethod(passSomeData);
                });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please help me understand this. You have a function that calls a few methods:
Please help I have 3 ImageViews and I can move that 3 views with
Please help me ! I have a problem in Crystal Report at visual studio::
Please help! Background info I have a WPF application which accesses a SQL Server
Please help to the newbie in WPF! I need to build a TreeView with
Please Help me to do this first i have this div <div class=loader alt=stat.php>
Please help me understand the meaning of this code. I have seen this kind
please help .... i have a tableview with a list of vehicle what i
Please help me decode the following. I have a problem in the network, unable
please help, I have WindowsXP, I have downloaded 3.1.18 bjam from https://sourceforge.net/projects/boost/files/boost-jam/ as it

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.