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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:53:54+00:00 2026-05-28T22:53:54+00:00

First off, I did look on google and stackoverflow, but nothing seem to really

  • 0

First off, I did look on google and stackoverflow, but nothing seem to really meet my desires.

That said. I am using an MVC application (It could just as well be a Web Forms app) that I inherited from a previous developer(s). The current Service References point at production servers and I would like to simply point also at local dev servers. Ideally I would like to not edit the web.config file for changing from dev to prod (especially if it is for several places etc..)

Thus, perhaps there is a “best practice” for adding extra web references and being able to quickly “swap and test” the DEV references to PROD references with very little configuration changes.

Perhaps a design pattern, or an appconfig setting to facilitate this process? It certainly would be ideal to keep it loosely coupled with constructor injection of the service references. Any thoughts on how to best implement this?

  • 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-28T22:53:55+00:00Added an answer on May 28, 2026 at 10:53 pm

    Another option would be to add multiple endpoint configurations for the same service that point to different addresses. Then when you create a new instance of your service client you pass the name of then endpoint configuration.

    ContractServiceContractClient client = 
    new ContractServiceContractClient("DEV_Endpoint");
    

    or

    ContractServiceContractClient client = 
    new ContractServiceContractClient("PROD_Endpoint");
    

    And in your ServiceReference config

    <endpoint address="http://localhost:7821/ContractService.svc"
              binding="basicHttpBinding" 
              bindingConfiguration="BasicHttpBinding_ContractService"
              contract="ContractServiceReference.IContractService" 
              name="DEV_Endpoint" />
    

    or

    <endpoint address="http://service.apps.com/ContractService.svc"
              binding="basicHttpBinding" 
              bindingConfiguration="BasicHttpBinding_ContractService"
              contract="ContractServiceReference.IContractService" 
              name="PROD_Endpoint" />
    

    Then if you just create a global static string or put something in your app.config that contains the name of the endpoint configuration you want to use, then you just have to change it in that one spot and it will update across the application.

    The only catch here is that you can’t create an instance of your service client without passing which endpoint configuration you want to use if you have more than one endpoint configuration for the same contract.

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

Sidebar

Related Questions

Ok, First off, I am not a mysql guru. Second, I did search, but
First off, I know I can copy "this" on instantiation, but that doesn't work
First off I apologize... I have posted this question before, but I did a
First off, this question is ripped out from this question. I did it because
First off, I am using Windows XP. I have multiple hard drives and it
First off: I'm using a rather obscure implementation of javascript embedded as a scripting
First off, I'm working on an app that's written such that some of your
First off, let me start off that I am not a .net developer. The
First off, I know next to nothing about language theory, and I barely know
I wanted to chop off all but the first five elements of an array,

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.