Web services 从web服务调用另一个wcf服务引发错误

Web services 从web服务调用另一个wcf服务引发错误,web-services,wcf,wcf-binding,Web Services,Wcf,Wcf Binding,我有一个控制台应用程序(即Project1/Solution1)。我正在从单独项目(即Project1/Soloution2)中的控制台应用程序调用一个web服务(.asmx) 通过单个web方法,可以调用两个不同的业务类方法(即Project2/Soloution2),这两个方法依次调用两个不同的外部wcf服务。 我以编程方式创建端点和绑定元素来调用wcf方法 EndpointAddress ed = new EndpointAddress(rtd.WebServiceUrl); BasicH

我有一个控制台应用程序(即Project1/Solution1)。我正在从单独项目(即Project1/Soloution2)中的控制台应用程序调用一个web服务(.asmx) 通过单个web方法,可以调用两个不同的业务类方法(即Project2/Soloution2),这两个方法依次调用两个不同的外部wcf服务。 我以编程方式创建端点和绑定元素来调用wcf方法

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)
我收到错误“在配置元素集合中找不到与键'BasicHttpBinding_TestService'匹配的元素”,尽管我添加了此配置 在我的app.config文件中

我的app.config文件中的节

<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>


甚至我在我的web方法所在的web.config文件(即Project1/Soloution2)和调用控制台应用程序的app.config文件中都添加了这个选项。

看看外部WCF服务中web.config文件中的绑定。WCF应用程序的Web.config和客户端应用程序的app.config中的绑定必须匹配,才能使绑定配置正常工作。

与论坛网站不同,我们不使用“感谢”或“感谢任何帮助”或签名。见”。