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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:31:59+00:00 2026-05-22T16:31:59+00:00

During debugging I added a bunch of service references pointing to services on the

  • 0

During debugging I added a bunch of service references pointing to services on the Debug machine. Is there any way to automatically regenerate the service references based upon the Configuration? I’d really rather not have to go through and point them all to the Release server when I’m ready to release, then when I need to debug go back and change them all again, etc.

Basicaly, I want the following (done automatically):

  • Debug -> http://localhost/App/Service1.svc
  • Release -> http://myserver/Service1.svc
  • 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-22T16:32:00+00:00Added an answer on May 22, 2026 at 4:32 pm

    There’s no way to do a conditional compilation for configuration. One thing I’ve used in some projects was to have #if statements in the code which updates the service reference from the config. Something similar to the code below:

    static void Main() {
        TestClient client = new TestClient();
        UpdateAddress(client.Endpoint);
    }
    static void UpdateAddress(ServiceEndpoint endpoint) {
        string address = endpoint.Address.Uri.ToString();
        int svcIndex = address.IndexOf(".svc");
        int serviceIndex = address.LastIndexOf("/", svcIndex);
        address = address.Substring(serviceIndex);
    #if DEBUG
        address = "http://localhost/App" + address;
    #else
        address = "http://myserver" + address;
    #endif
        endpoint.Address = new EndpointAddress(address);
    }
    

    Another thing, which I haven’t done, but I think may be possible, is to look at the msbuild targets. IIRC you can execute arbitrary commands from msbuild, so you could use a custom target depending on the build configuration, and run some command which would update your config file based on that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any watch window to see variable value in XCode during debugging? Can
Is there a way to nicely print dictionaries in XCode during debugging? Selecting print
I have a small problem during debugging my App in VS 2010 RC when
When navigating to previous calls/events during debugging with IntelliTrace, I can't see a snapshot
EDIT: I had made a mistake during the debugging session that lead me to
During many, sometimes inundating, debugging sessions using DDD, I stumble upon loops. And I
I remember I could add modifiers to a watched variable during debugging to make
In Visual Studio, it was possible during debugging sessions to jump to the line
During debugging, i need to inspect variables inside JDK, say the class of a
During debugging in Eclipse , my code went into the while loop ( I

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.