Results 1 to 5 of 5

Thread: How to handle web references???

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    How to handle web references???

    In my C/S project I have a webservice running on an application server... ICurrently only at test server
    Now I want to move my application to production, which is the best way to switch the webreferences from host "server_test" to "server_prod"? I mean, for every object I create which has webmethods I basically write

    dim t as new server_test.calculator
    dim res as integer

    res = calculator.subtract(4,6)



    Let's say I have a few 100 references to server_test in my solution, now I want to move this to host server_prod... How can I handle my application so it will change references to the service at server_prod instead? Which is the best way to do this????

    In my solution explorer I have added web references to server_test.. should I also add reference to server_prod, or should I create a separate solution for prod????


    kind regards
    Henrik

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Select the web reference then go to it's properties and set the URL Behavior property to Dynamic. This will create an entry in the app.config file. The web service will also now use the URL in the app.config file and thus can be easily changed.


  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    Gee, thanks! I have read at least two vb.net books including webservices, and neither of them have told me about this simple feature...!! Thanks!

    Henrik

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    One odd thing though... if I in my dev environment have the references at locahost, and then change to test or prod, the localhost name remains, but the underlying reference can be changed. This can be somewhat confusing if it in the code says
    dim t as localhost.service1

    but in the app.config says:
    <appSettings><add key="winapp.localhost.service1" value="http://prodserver/service1/proj_service.asmx"/></appSettings></configuration>

    kind regards
    Henrik

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can change it if you want. See the IDE just makes a wrapper class to work with the web service and by default it names it something similiar to the address even though it in no way relates to the actual address. I believe you can change it when setting the reference or at any time after by just editing the code that the IDE created. You should be able to reach it if you double click the class in the object viewer or maybe from the class explorer. The important thing to remember is that it is just a name.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width