Does anyone else have an issue with slow initial authentication against ASP.NET Basic Service?
有没有人对ASP的初始认证速度慢有问题?网络基本服务?
When my app logs in for the first time it takes around 3-4 seconds to auth against the server, after that it's pretty fast but this initial login time is disrupting users.
当我的应用程序第一次登录时,大约需要3-4秒的时间来访问服务器,之后会非常快,但是最初的登录时间会扰乱用户。
Does anyone else have this issue? If so, how did you resolve it? The service is using MVC4's WebAPI.
有人有这个问题吗?如果是的话,你是如何解决的?该服务使用的是MVC4的WebAPI。
1
I had this problem and I found out that it was authenticating multiple times on the first connection.
我遇到了这个问题,我发现它在第一个连接上进行了多次验证。
In your willSendRequestForAuthenticationChallenge method, add this to see what kind of auths or how many it's performing when you do your first connection call.
在willSendRequestForAuthenticationChallenge方法中,添加这个属性,以查看执行第一次连接调用时的auths类型或它执行了多少次。
NSLog(@"%@",[[challenge protectionSpace] authenticationMethod]);
I found that there were multiple auths like so:
我发现有很多这样的auths:
2013-11-30 11:31:42.181 AppName[1529:70b] NSURLAuthenticationMethodServerTrust
2013-11-30 11:31:50.921 AppName[1529:70b] NSURLAuthenticationMethodNTLM
Only some of them actually needed auth credentials, a few of them could be skipped using code like this for "NSURLAuthenticationMethodServerTrust"
只有其中一些实际上需要身份验证,其中一些可以使用“NSURLAuthenticationMethodServerTrust”之类的代码跳过
if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodServerTrust){
[[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge];
}
This sped it up a little for me. Also, moving to iOS7 sped it up quite a bit, since it moved some NSURLConnection handling into the OS. Other than that, I couldn't work with my server admins to relieve any of the extra security, maybe you have better luck.
这加快了我的速度。此外,迁移到iOS7时,它的速度提高了不少,因为它将一些NSURLConnection处理转移到了操作系统中。除此之外,我不能和我的服务器管理员一起来解除任何额外的安全,也许你有更好的运气。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2013/08/27/e712c99619e81302b3a7406f182a10ec.html。