Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 对Azure ASP.net web服务for Excel加载项的Ajax请求_Jquery_Asp.net_Ajax_Excel_Azure - Fatal编程技术网

Jquery 对Azure ASP.net web服务for Excel加载项的Ajax请求

Jquery 对Azure ASP.net web服务for Excel加载项的Ajax请求,jquery,asp.net,ajax,excel,azure,Jquery,Asp.net,Ajax,Excel,Azure,我目前正试图通过Excel加载项对Azure上托管的web服务进行ajax POST调用。当我在localhost上测试时,ajax请求工作得很好,但是现在当我尝试调用时,它给了我一个NetworkError。我使用的代码是: var user = { UserName: "username", Password: "password" } $.support.cors = true; $.ajax({ crossDomain: true,

我目前正试图通过Excel加载项对Azure上托管的web服务进行ajax POST调用。当我在localhost上测试时,ajax请求工作得很好,但是现在当我尝试调用时,它给了我一个NetworkError。我使用的代码是:

var user = {
     UserName: "username",
     Password: "password"
}

$.support.cors = true;
$.ajax({
        crossDomain: true,
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "http://qa-verso-enterprise-service.azurewebsites.net/VersoApiService.svc/AddIn/Login",
        data: JSON.stringify(user),
        dataType: 'json',
        traditional: true,
        async: false,
        cache: false,
        success: function (json) {
            console.log("Success");

        },
        error: function (er) {
            console.log("Error");
        }
    });
我尝试在JSFIDLE上模拟调用。你可以在这里找到它:

我还试着用DCH chrome分机打电话,一切都很好。铬-extension://aejoelaoggembcahagimdiliamlcdmfm/dhc.html 使用POST方法和数据:

{
    "UserName": "username",
    "Password": "password"
}
这会返回用户名无效的信息

读了一点我补充说

<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="Content-Type" />
    <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
  </customHeaders>
</httpProtocol>

到我的web服务的web配置,但这不起作用


我真的不知道还能做什么。。。有什么意见吗?

当你说现在失败了-你是什么意思?它在excel中工作,然后突然停止——或者与新服务器发生冲突——或者?我在本地运行web服务器,ajax调用的url:url:“”非常有效……当你说它现在失败了——你是什么意思?它在excel中工作,然后突然停止-或者与新服务器冲突-或者?我在本地运行web服务器,ajax调用的url:url:“”非常有效。。。