locked
Is any way to change WCF Test client config? RRS feed

  • Question

  • Can I change config file, that generates by WCF Test Client?
    I need to set maxRecievedMessageSize to larger value, to handle large messages.

    Thanks



    Wednesday, January 16, 2008 10:32 AM

Answers

  • The reason timeouts and MaxReceivedMessageSize can't be propagated to the generated client config is because that data is not propagated to the wsdl published by the service.  Only operation ports, and WS* standards are in metadata.  Further, MaxReceivedMessageSize on the service has nothing to do with MaxReceivedMessageSize on the client.  You can have a request-reply scenario where the request sent to the service is very small, but the service returns a large response.  In that scenario you MUST manually modify the MaxReceivedMessageSize on the client.  There's nothing in metadata about this.

     

    Thursday, January 17, 2008 6:15 PM

All replies

  • Victor,

     

    You can configure the maxRecievedMessageSize  binding property maually or through WCF Service configuration editor.

     

    Regards

     

    Prabhu

     

    Wednesday, January 16, 2008 3:02 PM
  • Yes. But I do this only on the service side. Or on client side with my own client.

    But, when "WCF Test Config Client" app starts for my service, client config builds dynamicly (I think) with default paramters.

    The question is: How I can change this parameters?

    Wednesday, January 16, 2008 3:39 PM
  • Hi Victor,

     

    Hope the below sample will help..

     

    BasicHttpBinding binding= new BasicHttpBinding();
    binding.MaxRecievedMessageSize = XXXXXX;
    EndpointAddress endpointAddress = new EndpointAddress("Your address");

    YourContractClient proxy = new YourContractClient(binding,endpointAddress);
    proxy.YourMethod();
    proxy.Close();

     
    Regards

     

    Prabhu

     

    Wednesday, January 16, 2008 4:03 PM
  • The above post gives a code solution to your question.  I'm guessing you have a service running, and you use SvcUtil.exe to generate the client proxy code, and a config file.  Then you instanciate the proxy and call methods on it, right?  And you want to change the MaxRecievedMessageSize on the client?  This would imply the Client is receiving messages, as is the case with request-reply operations (or duplex, too.)  So, you can manually modify the generated config file, but keep in mind those changes will be lost each time you regenerate the code.  To increase the MaxReceivedMessageSize in the client's config file, just look for the binding and modify that attribute.  If you paste the generated config file on this thread, I'll have a look and help out with this.

     

    The config file generated by SvcUtil.exe is created by looking at the metadata published by the service.  I don't think there's a way for the service to publish, in metadata, something like, "Client's MaxReceivedMessageSize must be n bytes."  I'll ask around if this is possible, because it sounds like what you need, but I don't think it's part of the metadata protocols.

     

    -James

    Wednesday, January 16, 2008 6:17 PM
  • I'm talking about nice little application, that ships with vs2008, WcfTestClient.exe.

    http://msdn2.microsoft.com/en-us/library/bb552364.aspx

    This app recieves mex endpoint of your service as argument, and generate proxy and config file on the fly.

    Ok?

     

    And I can't found any way to say this application, that MaxRecievedMessageSize must be larger, then default value. Or may be, timeout must be longer, then 1 minute.

     

    Is it possible?

     

    Wednesday, January 16, 2008 7:56 PM
  • Victor,

    WcfTestClient.exe communicates with service via MEX by downloading metadata from the service. Then why can't you set the MaxReceivedMessageSize prop of binding at server side itself and consume the same from this tool.

    IMHO WCFTestClient provides mechanism for filling only the data required by each service operation, invoking the operation, and viewing the results.

    Regards

    Prabhu
    Thursday, January 17, 2008 1:29 AM
  • The reason timeouts and MaxReceivedMessageSize can't be propagated to the generated client config is because that data is not propagated to the wsdl published by the service.  Only operation ports, and WS* standards are in metadata.  Further, MaxReceivedMessageSize on the service has nothing to do with MaxReceivedMessageSize on the client.  You can have a request-reply scenario where the request sent to the service is very small, but the service returns a large response.  In that scenario you MUST manually modify the MaxReceivedMessageSize on the client.  There's nothing in metadata about this.

     

    Thursday, January 17, 2008 6:15 PM
  • This doesn't answer the original question.

    Can the config file for the 'WCF Test Client' be changed?

     

    WcfTestClient.exe seems to use a new client dll config file each time it runs.

    eg...

    h:\Test Client Projects\8e7a7d58-01ff-45b2-b442-98c3fa0a373c\Client.dll.config

    then..

    h:\Test Client Projects\4534d329-ce39-4827-a6ae-c7fc37cb05fb\Client.dll.config

     

    It editing the file doesn't work, it must only get loaded when the test client first starts.

     

    And the file it uses has maxReceivedMessageSize="65536", which is no use at all.

     

     

    Thursday, February 28, 2008 5:42 PM
  • If the WCF Test Client dynamically generates the config on the fly, when it runs (which I believe it does), then you can't change the client's config file before it starts executing.  For this, you would need to break up what the Test Client is doing into two steps: 1. Manually generate the proxy, based on the service's WSDL.  (svcutil.exe)  2. Write the client code which uses the proxy and manually edit the config file.

     

    Then, you can run the client and it won't be regenerating the proxy.

     

    -James

    Thursday, February 28, 2008 5:53 PM
  • As "Victor Nazarenko" mentioned earlier in this thread.

    We are talking about this tool...

     

    WCF Test Client (WcfTestClient.exe)

    See: http://msdn2.microsoft.com/en-us/library/bb552364.aspx

    a WCF test tool that ships with Visual Studio 2008.

     

    The whole point of this tool is that a service can be tested without have to create any code.

    But it looks like the tool can't be used to test services that return more than 64k of data, because of the fixed config file.

     

     

     

     

    Friday, February 29, 2008 10:01 AM
  • Yes, you are correct.  As I understand it, to test services which return more bytes than MaxReceivedMessageSize, you would need to write the client code manually.  I'm confirming this with the Design Tools team to be absolutely sure.

     

    -James

     

     

     

    Friday, February 29, 2008 5:44 PM
  • I got a response from Design Tools. Currently, changing the WCFTestClient config isn't supported for the reasons I stated above.  However, in SP1, the TestClient has been improved so that the config can be edited, and changes persist through the session.  You'll have to wait about 3 months for SP1, though.

     

    -James

    • Proposed as answer by Uli F Wednesday, June 23, 2010 9:15 AM
    Friday, February 29, 2008 6:04 PM
  • Ok, thanks for the info.

    Nice to hear that a change is on it's way.

     

    Monday, March 3, 2008 9:10 AM
  • Well, I was facing a similar challenge. There is a manual way to do this until the tool gets updated.

     

    Start the client interface (WcfTestClient.exe) with the WCF Service HTTP

    Expand the service and right-click on the Web.Config (do not double-click - this will load the config file)

    Click on Copy Full Path

    Go to the file and edit the configuration sections you need to change (buffer limits, dns identity for https...)

     

    You can now start using the tool with a modified config file.

     

    Unfortunately everytime you restart the tool a new config file gets generated in a different folder. So this is a manual step. Still it helped me test an HTTPS endpoint that required changing the config file.

     

    Hope this helps

     

    • Proposed as answer by Adi Amir Tuesday, December 1, 2009 2:01 PM
    Friday, March 21, 2008 7:15 PM
  • A better is to use a tool like WCFStorm to dynamically invoke the service methods  http://www.wcfstorm.com.

    It also lets you edit the binding settings like MaxReceivedMessageSize via the GUI.
    Saturday, April 25, 2009 3:56 AM
  • Victor:  The correct answer is the one which Herve Roggero posted on 3/21/2008.  Please mark that as the answer.
    Monday, January 4, 2010 9:13 PM
  • Following up on the correct response: Once the file is edited you can go to tools-options and uncheck the box to not regenerate the config file.
    Thursday, March 4, 2010 4:13 PM
  • I also faced this error.

    each and every time when run the WCF Test Client it is dynamically create the config File and set the values to default.so if i change the value once it is not take effect when i run it again.

    only one movement it  increased the size of message. if i run it again then i faced same problem.

    can you tell me in more details how to solve this problem. i had spent lot of time with this error.

    help me to out from this error.

    thak you in advance

    Monday, February 14, 2011 10:35 AM
  • There now is a option in the tools/options tab always regenerate config when launching services.

    Wednesday, June 20, 2012 11:29 AM
  • The aswer is here my friend:

    http://msdn.microsoft.com/en-us/library/bb552364.aspx

    Persist Client Configuration

    The Tools->Options->Client Configuration tab contains an Always Regenerate Config When Launching Services option, which is enabled by default. This option specifies that every time WCF Test Client loads a service, it regenerates a configuration file based on the latest service contract and service App.config files.

    Thursday, August 23, 2012 8:24 PM
  • When the WCF Test Client is running...

    - Right-Click on the "Config File"

    - Choose "Edit with SvcConfigEditor"

    - Make your changes to your Bindings

    To restore your config to default values:

    - Right-Click on the "Config File"

    - Choose "Restore to Default Config"

    • Proposed as answer by Teemu Tikka Monday, October 17, 2016 1:04 PM
    • Unproposed as answer by Teemu Tikka Monday, October 17, 2016 1:06 PM
    • Proposed as answer by Teemu Tikka Monday, October 17, 2016 1:06 PM
    Wednesday, December 11, 2013 6:47 AM
  • I don't know you this problem has been solved, but this is the path for the WCFTestClient.config

    Program Files\Microsoft Visual Studio 12.0\Common7\IDE

    Have fun!

    Monday, June 2, 2014 8:03 AM
  • bueno mas vale tarde que nunca, a mi este problema también me dio hoy día, la forma de resolverlo es simplemente cambiando el Client.dll.config en la ruta que muestra el svcconfigEditor, por ejemplo en mi caso estaba en C:\Users\ALVARADOZS\AppData\Local\Temp\Test Client Projects\10.0\82e4179b-22c1-4d9a-903f-3d6d1369d9e2

    lo cual se genera dinámicamente.  lo Probé y funcionó saludos.  y como buena costumbre siempre tengo desactivada la opción de always regenerate config when ....

    Esta es la respuesta correcta a este problema, espero haberlos ayudado y a las nuevas personas que revisan este foro.  :)

    better late than never, It also gave me this problem today, so the way to solve this is by simply changing the Client.dll.config that SvcConfigEditor shows in the path, for example in my case was in C: \ Users \ ALVARADOZS \ AppData \ Local \ Temp \ Test Client Projects \ 10.0 \ 82e4179b-22c1-4d9a-903F-3d6d1369d9e2 which is dynamically generated . I tried it and it worked. and as a good practice, I have always disabled the option to "always regenerate config When ...." This is the correct answer to this problem, and hope I've helped new people reviewing this forum. :)


    StuAlvarado

    Tuesday, August 5, 2014 7:59 PM
  • I was looking for a solution of this problem for a long time. This reply was the key to it. I wonder why Microsoft doesn't metion this in their documentation. Is seems to me as if MS is testing "quality" software at their customers. 

    A_SqlDeveloper

    Thursday, June 11, 2015 12:30 PM