我有一個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)
我已經在我的類庫(中間層),其被引用到我的MVC應用程序中引用此包裝的DLL。
遺憾的是它不工作,和我收到此錯誤:
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.
Webconfig
<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>
端點必須在「啓動項目」的.config,https://msdn.microsoft.com/en-us/library/09138bex(v=vs.90).aspx – Mate
您可以通過「開始的意思項目「? –
是的,我在我的啓動項目的webconfig中有它 –