0

I have one console application (i.e. Project1/Solution1).I am calling one web service (.asmx) from console application which is in separate project (i.e. Project1/Soloution2) Through single web method there is call to two different business class methods (i.e. Project2/Soloution2) which in turn call two different external wcf services. I am programmatically creating the endpoint and binding elements to call the wcf methods.

EndpointAddress ed = new EndpointAddress(rtd.WebServiceUrl);
BasicHttpBinding binding = new BasicHttpBinding("BasicHttpBinding_TestService");
ServiceClient client = new ServiceClient(binding, ed);

string response = client.Getdetails(string input1, string input2)

I am getting error "No elements matching the key 'BasicHttpBinding_TestService’ were found in the configuration element collection" although I have added this configuration in my app.config file.

Section in my app.config file

<binding name="BasicHttpBinding_TestService" closeTimeout="00:00:05"
                    openTimeout="00:00:05" receiveTimeout="00:00:15" sendTimeout="00:00:05"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="2047487456" maxBufferPoolSize="524288" maxReceivedMessageSize="2047487456"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="2047487456"
                        maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="Transport">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>

Even I added this in the web.config file where my web method resides (i.e. Project1/Soloution2) and in the calling console application's app.config file.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Tina
  • 3
  • 3
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). – John Saunders Feb 18 '14 at 03:41

1 Answers1

0

Take a look at the bindings in your web.config files from your external WCF service. The bindings in the Web.config of the WCF application and the app.config of the client application must match in order for that binding configuration to work.

HOKBONG
  • 795
  • 7
  • 17