none
Configuring WCF web.config client section RRS feed

  • Question

  • I try to connect two services. One of them is Java web service and second one is IIS WCF service which acts as client connecting to Java Web Service. I need to set receive timeout for WCF service in web.config file. I think I should set up <client> section of web.config file. But I have no idea how to do that. I do not know where to obtain contract string of Java Web Service. Any ideas? Please, could anyone provide me a good example? Thanks.
    Friday, June 21, 2013 7:52 AM

Answers

  • Hi,

    Use an app.config like this (when you use "Add Service Reference" from Visual Studio, VS will typically create this for you automatically - and you just need to tweak it to your needs):

    <client>
       <endpoint name="myService" address="net.tcp://localhost/whatever" binding="netTcpBinding" bindingConfiguration="ShorterTimeout" contract="MyService.IService" />
    </client>
    
    <bindings>
       <netTcpBinding>
          <binding name="ShorterTimeout" openTimeout="00:00:10" closeTimeout="00:00:10" sendTimeout="00:00:10" />
       </netTcpBinding>
    </bindings>

    The section and its possible values and subsection are well documented in the WCF configuration.

    Alternatively, you can use the "WCF Service Configuration Editor" - see it in "Tools > WCF Service Configuration Editor".

    alt text

    It allows you to visually define and modify your client config settings. Once you've launched it from the Tools menu, after that, you can acutally even right-click on the app.config in your Solution Explorer and launch it from there (using that app.config as its basis).

    alt text

    For more information about wcf client configure:
    http://msdn.microsoft.com/en-us/library/ms731745.aspx .

    Hope it can help you.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 24, 2013 7:55 AM
    Moderator
  • Thank you for reply. VS didn't created app.config for me, because I didn't reference WS in standard WPF application, but I referenced it in service application. Due this fact I have only web.config file. Anyway I solved my problem. The problem was, that WS responded in specified timeout, but it took too much time to my service to process response of the WS. So I set binding.SendTimeout programatically to higher value and it solved the problem.

    Friday, June 28, 2013 6:05 AM

All replies

  • Hi,

    Use an app.config like this (when you use "Add Service Reference" from Visual Studio, VS will typically create this for you automatically - and you just need to tweak it to your needs):

    <client>
       <endpoint name="myService" address="net.tcp://localhost/whatever" binding="netTcpBinding" bindingConfiguration="ShorterTimeout" contract="MyService.IService" />
    </client>
    
    <bindings>
       <netTcpBinding>
          <binding name="ShorterTimeout" openTimeout="00:00:10" closeTimeout="00:00:10" sendTimeout="00:00:10" />
       </netTcpBinding>
    </bindings>

    The section and its possible values and subsection are well documented in the WCF configuration.

    Alternatively, you can use the "WCF Service Configuration Editor" - see it in "Tools > WCF Service Configuration Editor".

    alt text

    It allows you to visually define and modify your client config settings. Once you've launched it from the Tools menu, after that, you can acutally even right-click on the app.config in your Solution Explorer and launch it from there (using that app.config as its basis).

    alt text

    For more information about wcf client configure:
    http://msdn.microsoft.com/en-us/library/ms731745.aspx .

    Hope it can help you.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 24, 2013 7:55 AM
    Moderator
  • Thank you for reply. VS didn't created app.config for me, because I didn't reference WS in standard WPF application, but I referenced it in service application. Due this fact I have only web.config file. Anyway I solved my problem. The problem was, that WS responded in specified timeout, but it took too much time to my service to process response of the WS. So I set binding.SendTimeout programatically to higher value and it solved the problem.

    Friday, June 28, 2013 6:05 AM