Wednesday, July 1, 2009

Changing the WCF Test Client configuration

Today I was testing a service method that returns bigger amount of data with the with wcftestclient. Unfortunately the test client uses a lot of default settings in the generated client configuration, so the message size quota is limited to 65536 bytes. This means that you get the following exception:

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

Can this be changed easily? The answer is yes!

Having the latest .NET 3.5 SP1 and VS 2008 on my box the test client not only shows the service hierarchy (in the tree on the left hand side) but there is also a “Config File” node for each service. With double-click you can open the client configuration file in a tab in read-only mode (and you can see the default settings causing the problem).

image

If you right-click the node you get further options. You can copy the full path of the config file if you want to open it with a text editor, or you can choose to edit it with the SvcConfigEditor tool.

Either way, you can just go and change the client configuration according to your needs. The tool watches the configuration file for changes. As soon as you save your changes it offers you the possibility to reload the configuration in a pop window.

image

There is one more issue that you should be aware of. If you close the tool and run it later again you can easily reopen the recently used services from the menu (File/Recent Services) BUT your configuration changes will be not preserved. If you want your changes to be kept go to the Tools/Options… menu and uncheck the option “Always regenerate config when launching services”.

image

If you want to revert back to the default configuration again, you can right-click the “Config File” node and select the “Restore to Default Config” command from the context menu.

3 comments:

  1. This does not work, VS2019, win10, wcftestclient always writes default config in to AppData/xxx-xxxx-xxxx temp folder

    ReplyDelete
  2. You must be running in Debug mode in visual Studio

    ReplyDelete
  3. What I did was after updated the Client.dll.config to what I wanted I copied it to the default.config file. Back to the WCF Test Client window, right click on Config file and choose Restore to Default Config. Hope this will help.

    ReplyDelete