简体   繁体   中英

502 requesting payment service inside azure 'website'

I am getting this error from a call to an external payment service. The error only occurs when deployed to azure and works perfectly locally.

"Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server."

The payment service class are generated with this wdsl

https://pal-test.adyen.com/pal/Payment.wsdl

It appears that the error occurs in the authorise method of the Payment class but I cant get azure to log anything useful even when all logging options are on.

Has anyone else had this problem?

UPDATE

I have narrowed the problem down a little. The test method of the controller below will cause an azure website to crash with a 502 and restart.

public class TestController : Controller
{      
    public string test()
    {
        try
        {
            var webClient = new WebClient();
            var stream = webClient.OpenRead("https://pal-test.adyen.com/pal/servlet/soap/Payment");
            var streamReader = new StreamReader(stream);
            return streamReader.ReadToEnd();

        }
        catch (Exception exp)
        {
            errorResult(exp);
        }
        return formattedResult(result);
    }    
}

MS seem to have removed some of the HTTP protocol for azure website. Specifically this is blocked it seems SEC_I_RENEGOTIATE.

Is there any work around? Does anyone know if this method will work in a web role?

It's possibly a problem with the proxy server in use... try the following

UseDefaultWebProxy=false

to stop your app using machine specific proxy settings and instead use any user defined / web.config settings.

As JcFX commented above, the URL you are using is incorrect!... it should be

https://pal-test.adyen.com/pal/servlet/soap/Payment

ie you are missing the hyphen in pal-test

当我转到该URL时,它似乎想要使用HTTP身份验证,您是否获得了可以设置的测试系统的密码?

webClient.Credentials = new NetworkCredential("username", "password");

Do you by any chance use a .pfx certificate file or similar?

If so, the way you reference it could be problematic in Azure, consider using Azure CertificateStore instead of having your certificates on the filesystem(if you're doing this now)

for more details: https://msdn.microsoft.com/en-us/library/azure/gg465712.aspx

also relevant:

https://azure.microsoft.com/blog/2014/10/27/using-certificates-in-azure-websites-applications/

Hope this helps! Good luck to you, this problem has been a real nightmare for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM