Ajax请求https url的问题 [英] Problem with Ajax Request to https url

查看:131
本文介绍了Ajax请求https url的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所示,我在尝试在Visual Studio Express 2012中运行的Windows 8 Windows应用商店应用中(直接或通过WinJS.xhr函数)创建XMLHttpRequest时遇到问题。是对https网址的POST,其中包含"内容类型"
设置为"text / plain"。

As the title suggests, I'm having a problem with trying to make a XMLHttpRequest (either directly or via the WinJS.xhr function) in a Windows 8 Windows Store app running in Visual Studio Express 2012. The request is a POST to a https url, with "Content-type" set to "text/plain".

发出请求时,VS错误控制台出现以下错误:

I get the following error in the VS error console when the request is made:

XMLHttpRequest:网络错误0x2ef3,由于错误00002ef3无法完成操作。

XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3.

如果我将类型或方法切换为GET而不是POST,我只是从服务器返回预期的错误数据,抱怨使用了错误的请求类型。

If I switch the type or method to GET instead of POST, I just get the expected error data back from the server which complains about using the wrong request type.

我非常感谢有关这个问题的人。谢谢。

I would greatly appreciate anyone shedding some light on this issue. Thanks.

PS。几乎每个功能都在package.appxmanifest中启用。唯一不是文档库。以防万一是问题;)

PS. Pretty much every Capability is enabled in package.appxmanifest. The only one that is not is Document Library. Just in case that was the problem ;)

推荐答案

这是问题的一般解决方案。问题源于Metro应用程序无法识别给定的
服务器的证书(用于验证安全服务器),因此需要将服务器的公共证书手动添加到app manifest xml文件中在链接的讨论中描述。

Here is a general solution to the problem. The issue stems from the fact that the Metro app does not recognize a given server's Certificates (used to verify a secure server), so the server's public certificate(s) need to be manually added to the app manifest xml file as described in the linked discussion.

干杯。


这篇关于Ajax请求https url的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆