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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:19:35+00:00 2026-06-05T07:19:35+00:00

I have a small, basic working example of using WCF to get two applications

  • 0

I have a small, basic working example of using WCF to get two applications to talk to each other. My client app, that listens to the server, has XML in the app.config file that configures my settings. One setting that is hard-coded at compile time is the sendTimeout settings that is buried under the basicHttpBinding setting. For example:

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IScriptRunHost" closeTimeout="00:05:00"
                    openTimeout="00:05:00" receiveTimeout="00:05:00" sendTimeout="00:00:15"

I would like to be able to set the sendTimeout property at runtime (using c#). However being so new to WCF I don’t know where to start?

  • 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-06-05T07:19:36+00:00Added an answer on June 5, 2026 at 7:19 am

    You can do whatever you do in your config file, in code. You can set your timeouts or various configuration details dynamically by creating a new client proxy and assigning the desired binding configurations to it at run time:

    ServiceClient _client = new ServiceClient(new BasicHttpBinding { SendTimeout = new TimeSpan(2, 0, 0) },new EndpointAddress("http://localhost:8089/MyService.svc"));
    

    or:

    BasicHttpBinding myBinding = new BasicHttpBinding();
                     myBinding.OpenTimeout = new TimeSpan(2, 0, 0);
                     myBinding.CloseTimeout = new TimeSpan(2, 0, 0);
                     myBinding.SendTimeout = new TimeSpan(2, 0, 0);
    
    ServiceClient _client = new ServiceClient();
                  _client.Endpoint.Binding = myBinding;
    

    But as you can probably infer by glancing at the code, if you want to change your timeout values, your service endpoint, or pretty much any of your binding configurations at run time, you’d have to tear down the previous client proxy and dispose of it and use the new one you created, obviously this has some undesired effect as your clients will momentarily be disconnected from your service, so bear that in mind. You could also define 2 or 3 (or as many as you wish) binding configurations in your config file, and create a new client and configure it to use that binding, which is almost identical to doing it in code. Even this way you’d have to instantiate a new client proxy to be able to use a different binding configuration.

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

Sidebar

Related Questions

I have few small basic problems : How to format : int i =
I have small database of business and their addresses. Using the Google Geocode API
I have small test app: Socket socket = new Socket(jeck.ru, 80); PrintWriter pw =
I have small web app that generate PDF files as a report. I'm trying
I have small game engine written in c++. I'm considering using some features of
i'm working on a small project that is supposed to allow basic searches of
I am working with some CSS for a small menu idea I have. I
I'm working on a small game geometry library, and among a bunch of other
I've been working writing fairly small applications and doing some maintenance work for some
I am working on a small library, where I have following requirements for any

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.