Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Changing ServiceReference doesn't change endpoint RSS

2 replies

Last post May 28, 2008 03:26 AM by party42

(0)
  • party42

    party42

    Participant

    1150 Points

    351 Posts

    Changing ServiceReference doesn't change endpoint

    May 23, 2008 04:42 AM | LINK

    Hiya guys,

    following this article by Pete Brown (here) he says:

    Note that the default endpoint has the address in the file. You can override this in code if you desire. However, since this is a configuration file, you'll probably want to change (and maintain) the endpoint address in the config here, prior to deploying your app to test/production.

    Now, especially the last sentence, it sounds great but it just doesn't work. Chaning the endpoint address in the ServiceReferences.ClientConfig file somehow doesn't change the endpoint. Here's the code I use to find that out:

    private static SoapClient InitService()
            {
                BasicHttpBinding binding = new BasicHttpBinding()
                {
                    MaxBufferSize = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue
                };

                SoapClient p = new SoapClient();

                EndpointAddress address = new EndpointAddress(p.EndPointAddress);
                return new SoapClient(binding, address);
            }

    test 1: endpoint is set by default to say http://www.foo.com/foo.svc
    Output 1; p.EndPointAddress = http://www.foo.com/foo.svc

    test 2: changing endpoint in service reference to http://www.foo2.com/foo2.svc
    Output 1; p.EndPointAddress = http://www.foo.com/foo.svc

    Anyone know howto fix this? Obviously I can reset it in the above "Init()" method using hardcoded strings but hey... [:S]

    Cheers, Nathan 


    Regards,
    Nathan Brouwer

    http://www.nathanbrouwer.nl
  • Allen Chen – MSFT

    Allen Chen –...

    Star

    13897 Points

    1809 Posts

    Microsoft

    Re: Changing ServiceReference doesn't change endpoint

    May 26, 2008 04:08 AM | LINK

    Hi:

      The client config file does not work in current Silverlight. We have to explicitly specify the address in code. It'll take effect in Beta 2 which will be released very soon.

    Regards

    Sincerely,
    Allen Chen
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • party42

    party42

    Participant

    1150 Points

    351 Posts

    Re: Changing ServiceReference doesn't change endpoint

    May 28, 2008 03:26 AM | LINK

     ok, thanks.

    Regards,
    Nathan Brouwer

    http://www.nathanbrouwer.nl