C#调用Magento soap服务端点绑定未使用HTTP?

时间:2018-08-20 13:01:36

标签: c# api http endpoint

I am using C# to call Magento SOAP API, and we have until now using HTTP to call this service. Now we have install SSL to our website so soap is no longer available from HTTP. 

So for change I have modify service in my Visual Studio project and my App.config have change into:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="Binding" maxBufferPoolSize="200000000" maxReceivedMessageSize="200000000" >
                    <security mode="Transport" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://www.ourwebstore.com/api/v2_soap/" binding="basicHttpBinding"
                bindingConfiguration="Binding" contract="ServiceReference.PortType"
                name="Port" />
        </client>
    </system.serviceModel>
    </configuration>

在修改服务请求之前,https是HTTP。使用HTTP可以正常且快速地工作。但是,当我们升级到https时,问题是我们的呼叫服务速度变慢,并且是随机的(有时有时未完成该过程),但我得到一个错误(在使用HTTP之前,此错误未显示)。错误是:

Unhandled Exception: System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to https://www.ourwebstore.com/api/v2_soap/. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

有什么问题吗?

0 个答案:

没有答案