为什么IE11创建时提琴手运行除空白POST请求?空白、提琴手、POST

由网友(疯疯癫癫的小情绪)分享简介:我AngularJS $ HTTP POST请求我的C#的WebAPI RESTful服务在Internet Explorer 11 Firefox和Chrome在Windows 8.1中失败都工作。My AngularJS $http post requests to my C# WebAPI restful se...

我AngularJS $ HTTP POST请求我的C#的WebAPI RESTful服务在Internet Explorer 11 Firefox和Chrome在Windows 8.1中失败都工作。

My AngularJS $http post requests to my C# WebAPI restful service fail on Windows 8.1 in Internet Explorer 11. Firefox and Chrome both work.

更多的细节:

IT部门说,我们的网络没有代理所有自动检测和使用代理设置是所有的浏览器未检查的请求未能IIS都在我的本地和运行的本地服务器上的网站和服务 IE11增强保护模式关闭请求的连接头是保活(我想关闭也是一样,它还是没有)有时一个请求会成功,只能从第二个请求将失败的一切没有显示错误 - 在IE浏览器的网络选项卡上的要求只是说待处理和所有的标题和正文都是空白我使用HTTP,HTTPS不是我试过元标记X-UA兼容IE9和边缘的请求失败为自己的机器上使用IE11过的同事在所有浏览器中的所有呼叫工作完全当小提琴手正在运行的Visual Studio 2013的浏览器链接关闭(所以SignalRArtery JS文件不会不断取得调用服务器和测试干扰)

我AngularJS请求调用看起来是这样的:

My AngularJS request call looks like this:

var url = UrlService.GetUrlOfApi() + 'Account/SignIn';
var postData = { 'username' : username, 'password' : password };
$http(
{
    'url': url,
    'data': postData,
    'method': 'POST'
})
.success(function (data)
{
     ...

我的C#的服务看起来是这样的:

My C# service looks like this:

[RoutePrefix("Account")]
[AllowAnonymous]
public class AccountController : BaseController
{        
    [ResponseType(typeof(SecureResponseModel))]
    [Route("SignIn")]
    [HttpPost]
    public IHttpActionResult SignIn(HttpRequestMessage request)
    {
        try
        {
            var userSignInDetails = GetPostData<AuthenticationRequestMessage>(request);
            var token = _hisManager.AuthenticateUser(userSignInDetails.Username, userSignInDetails.Password);
            return new SignInResponseMessage(token, ApiErrorCode.success, Request);
        }
        catch(APIException e)
        {
            throw;
        }
    }

这是一个失败的调用看起来像IE11,完全空白:

This is what a failing call looks like in IE11, totally blank:

这是一个成功的呼叫外观提琴手时运行,如:

This is what a successful calls looks like when Fiddler is running:

谁能推荐任何其他设置来检查或可以尝试吗?

Can anyone recommend any other settings to check or things to try please?

推荐答案

我已经解决了这个问题。我的同事建议获取简单的情况下工作的传统调试策略 - 所以我提出,每工作一个呼叫测试后的控制器Web服务:

I have fixed this. My colleague advised the traditional debugging strategy of getting the simplest case to work - so I made a test post controller web service that worked every call:

我然后看到这个方法和失败是BaseController,其中载有这些方法的一个之间的唯一区别是:

I then saw the only difference between this method and the one that failed is the BaseController, which contained these methods:

然后我改变了code这个移除可疑的异步和等待命令:

I then changed the code to this to remove the suspicious looking async and await commands:

现在一切都完美。但是,任何人都可以解释,为什么?在谷歌上搜索我的这个问题在过去的一天,我读过有关IE浏览器发送两个包而不是一个像其他浏览器,以及对资源保持打开的连接与干扰。但我不明白这一点的await命令如何打破只在一个浏览器的连接。

Everything now works perfectly. But can anyone explain why? In my googling this problem for the past day I've read about IE sending two packets instead of one like other browsers, and about resources being left open interfering with connections. But I don't understand how this await command broke the connection in just one browser.

阅读全文

相关推荐

最新文章