找不到引用合同的默认端点元素

Could not find default endpoint element that references contract

我有一个 ASP .NET MVC 应用程序,我希望它能够连接到 SOAP API。

我已经创建了一个包装器项目,因为我有与 API 一起使用的常用方法。我创建了这个包装器,因为工具生成的文件非常大,项目构建需要很长时间。 来自 api 文档站点:

The tool then generates a single file named EconomicWebService.cs with the proxy code. This file can then be included directly in a project (this can slow down your Visual Studio as it is a rather big file) or built into a dll that can be referenced from your project)

我在我的 class 库(中间层)中将此包装器作为 dll 引用到我的 MVC 应用程序中。

遗憾的是它不工作,我收到这个错误:

Could not find default endpoint element that references contract 'S2s.Economic.WebService.EconomicWebServiceSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

网络配置

<system.web>
   .....
</system.web>

<runtime>
...
</runtime>

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
         <binding name="EconomicWebServiceSoap">
             <security mode="Transport" />
         </binding>
         <binding name="EconomicWebServiceSoap1" />
      </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://api.e-conomic.com/secure/api1/economicwebservice.asmx"
            binding="basicHttpBinding"  bindingConfiguration="EconomicWebServiceSoap"
            contract="PTS.S2s.Economic.WebService.EconomicWebServiceSoap"
            name="EconomicWebServiceSoap" />
    </client>
</system.serviceModel>
</configuration>

我已设法在代码中找到手动端点设置的解决方法。

 EndpointAddress  endpoint = new EndpointAddress( "https://api.e-conomic.com/secure/api1/economicwebservice.asmx" );