No Touch Deployment and Web Services.

Discussion in 'ASP .Net Web Services' started by Mats-Erik Grundh, Oct 16, 2003.

  1. No Touch Deployment and Web Services.

    How do you programatically configure wich server to
    access?

    My environment:
    - Locahost.
    - Test server.
    - Production server.

    My problem is that same webservice deploys on localhosts,
    development server, test server and production server and
    i want to control from the shortcut on the desktop, or
    som other way, on
    which server to access webservice from, like this:

    C:\WINNT\Microsoft.NET\Framework\v1.1.4322\IEExec.exe
    http://ozzy/conet/client/bin/co.win.exe?server=ozzy

    the parameter server=ozzy tells which server to run
    webservice on.

    PS:I've tested the option dynamic on web reference
    properties but i cant find a way to programatically
    change
    the settings in application.config file.

    Thanks in advance!
    Mats-Erik Grundh, Oct 16, 2003
    #1
    1. Advertising

  2. You may modify the config file before call the web service, for example:

    Dim doc As New XmlDocument

    doc.Load("WindowsApplication2.exe.config")

    Dim n As XmlNode

    n =
    doc.DocumentElement.SelectSingleNode("/configuration/appSettings/add[@key='W
    indowsApplication2.localhost.Service1'] ")



    n.Attributes(1).InnerXml =
    "http://AppServer/WebService1/Service1.asmx"

    doc.Save("WindowsApplication2.exe.config")

    doc = Nothing

    Dim o As New localhost.Service1

    MsgBox(o.GetString)


    This will change the web service's url dynamically.

    Luke
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    ¥xÆW·L³n§Þ³N³B¤ä´©³¡, Oct 16, 2003
    #2
    1. Advertising

  3. Mats-Erik Grundh

    MSFT Guest

    Hello,

    If my suggestion is not clear or you didn't think it can resolve the
    problem, please post your comments here. I will continue to follow up on
    this issue.

    Thanks,

    Luke
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    MSFT, Oct 20, 2003
    #3
  4. Thanks, but how do i get access to the app.config file
    when i use "No Touch Deployment" like:

    ...\Framework\v1.1.4322\IEExec.exe http://server/my.app.exe

    /Mats-Erik

    "MSFT" <> wrote in message
    news:...
    > Hello,
    >
    > If my suggestion is not clear or you didn't think it can resolve the
    > problem, please post your comments here. I will continue to follow up on
    > this issue.
    >
    > Thanks,
    >
    > Luke
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    Mats-Erik Grundh, Oct 20, 2003
    #4
  5. Mats-Erik Grundh

    MSFT Guest

    Then you may try to set the web service's url property, for example:

    Dim o As New Server1.Service1

    o.Url = "http://Server2/WebService1/Service1.asmx"

    MsgBox(o.GetString)

    Luke
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    MSFT, Oct 21, 2003
    #5
  6. I don't think it's a possible solution beacause we have a
    huge application with many calls to different webservices
    (on same server) and i'ts not reliable to use the URL
    property in your code if the developer forgot to write the
    url before the call.

    "MSFT" <> wrote in message
    news:...
    > Then you may try to set the web service's url property, for example:
    >
    > Dim o As New Server1.Service1
    >
    > o.Url = "http://Server2/WebService1/Service1.asmx"
    >
    > MsgBox(o.GetString)
    >
    > Luke
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    Mats-Erik Grundh, Oct 21, 2003
    #6
  7. Mats-Erik Grundh

    MSFT Guest

    When we redirect a web service, there may two ways:

    1. Modify its url in code
    2. Specify its url in config file.

    Since your appliaction was executed thhorugh IEexec, it is hard to modify
    config file on the web server. Therefore, the only resort is achieving this
    in code. If we have a better design in the code, for example, when
    developer need to call a web service, he need to call a public method:


    Dim webobj= GetWebServiceObject()

    Public Function GetWebServiceObject() as Server1.Service1


    Dim o As New Server1.Service1
    o.Url = strWebServiceUrl

    return o

    End Function

    Luke
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    MSFT, Oct 22, 2003
    #7
  8. Hi Mats-Erik,

    We had a similar setup on a project I worked on. We used the
    simple logic of having the client call webservices always on the
    same server it was deployed from. The client can find out where
    it was deployed from through the Assembly.CodeBase property. I
    believe this returns the same value as the AppDomain.ApplicationBase
    property that someone already suggested.

    The application was built and tested with all web service proxies
    pointing to localhost.

    The way we got the new URLs at runtime into all the proxies (there
    was quite a few of them) is the client used a helper class to
    obtain the proxy instances. This helper class managed all the
    web service proxies. It replaced the URLs at runtime by figuring
    out the URL and assigning it to the Url property before handing
    out the proxy. There was no danger for a programmer to forget to
    set the Url of a proxy because the helper class was the only point
    of access to them.

    There were a few more details of course but I think you'll get
    the picture.

    Regards,
    Sami
    Sami Vaaraniemi, Oct 25, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mats-Erik Grundh

    No Touch Deployment and Web Services.

    Mats-Erik Grundh, Sep 30, 2003, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    114
    Mats-Erik Grundh
    Oct 2, 2003
  2. Mats-Erik Grundh

    No Touch Deployment and Web Services.

    Mats-Erik Grundh, Oct 4, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    134
    Mats-Erik Grundh
    Oct 4, 2003
  3. Mats-Erik Grundh

    No Touch Deployment and Web Services.

    Mats-Erik Grundh, Oct 14, 2003, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    122
    Mats-Erik Grundh
    Oct 17, 2003
  4. Mats-Erik Grundh

    No Touch Deployment and Web Services.

    Mats-Erik Grundh, Oct 15, 2003, in forum: ASP .Net Web Services
    Replies:
    10
    Views:
    216
  5. Han Holl
    Replies:
    4
    Views:
    336
    Nobuyoshi Nakada
    Oct 12, 2006
Loading...

Share This Page