locked
Smart Client App Configuration Help RRS feed

  • Question

  • Hi 

    I am trying to currently configure my app.config file so that I can connect to multiple Application Servers but have had no luck. I want to be able to save for example 3 servers locations in the file

    1.Production
    2.Test
    3.Uat

    Now when the user opens the application there is combo box from which they can select either server. Once they select the server the application will talk to the appropriate WCF app server.

    I have been trying to change the endpoint address in the SmartClient app.config but have had no luck.

    I have found many articles online with changing the settings at the WCF, but my need is to change it on the SmartClient Side.

    any help would be really appriciated.

    Regards

    B
    • Edited by buzzness007 Thursday, September 17, 2009 8:22 PM
    • Moved by eryang Friday, September 18, 2009 8:51 AM (From:.NET Base Class Library)
    Friday, September 11, 2009 3:18 PM

Answers

  • Hi Bhavik,

    If what is setup a WCF service host(with endpoints) without app.config file, you can completely use code to setup and configure the servicehost. Here is a web article mentioned this:

    #Programmatic Endpoint Configuration
    http://en.csharp-online.net/WCF_Essentials%E2%80%94Programmatic_Endpoint_Configuration

    Also, if you have installed the latest windows sdk(for .net 3.0 or 3.5), the WCF samples also contains many examples on using code to setup WCF service.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, September 21, 2009 2:41 AM
  • Thanks for this information, I found my solution here
    • Marked as answer by buzzness007 Wednesday, September 23, 2009 1:52 PM
    Wednesday, September 23, 2009 1:52 PM

All replies

  • The config file below:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>
            <client>
                <endpoint address="http://liveserver:8731/Design_Time_Addresses/MyFakeServer/Service1/wsHttp"
                    binding="wsHttpBinding" contract="ServiceReference1.IService1" name="Server">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="http://testserver:8731/Design_Time_Addresses/MyFakeServer/Service1/basic"
                    binding="basicHttpBinding" contract="ServiceReference1.IService1" name="Test" />
            </client>
        </system.serviceModel>
    </configuration>
    specifies two alternate endpoints for the ServiceReference1.IService1 contract. I've changed the binding type as well as the server and URL, just to show that it can be done. If you pass in the name of the endpoint you want to use when you create your client proxy, it will pick up that endpoint for you.

    Best regards,
    Johan Stenberg
    Microsoft Visual Studio


    Microsoft Visual Studio
    • Proposed as answer by eryang Wednesday, September 16, 2009 8:04 AM
    Friday, September 11, 2009 8:26 PM
  • Hi There

    Thanks for the response, but is there anyway to have this configured  at run time, 

    I want to be able to give the user the ability to select whichever server they want to connect to.

    Regards

    Bhavik Dhanjee
    Thursday, September 17, 2009 8:24 PM
  • So, you want to connect to different server according to user's selection at runtime, am i right?
    If yes, add multiple endpoints in the app.config first, and when initiating a WCF call, according to user's selection, we can use different endpoint to create different proxy, different proxy redirect the call to different server.

    I moved this post to WCF forum for better support.

    Thanks,
    Eric
    Please remember to mark helpful replies as answers and unmark them if they provide no help.
    Friday, September 18, 2009 8:50 AM
  • Hi Bhavik,

    If what is setup a WCF service host(with endpoints) without app.config file, you can completely use code to setup and configure the servicehost. Here is a web article mentioned this:

    #Programmatic Endpoint Configuration
    http://en.csharp-online.net/WCF_Essentials%E2%80%94Programmatic_Endpoint_Configuration

    Also, if you have installed the latest windows sdk(for .net 3.0 or 3.5), the WCF samples also contains many examples on using code to setup WCF service.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, September 21, 2009 2:41 AM
  • Thanks for this information, I found my solution here
    • Marked as answer by buzzness007 Wednesday, September 23, 2009 1:52 PM
    Wednesday, September 23, 2009 1:52 PM