简体   繁体   English

ASP.NET MVC方法被调用两次

[英]ASP.NET MVC Method being called twice

We have an controller method that is being called twice. 我们有一个被两次调用的控制器方法。 The first time it is called we get the correct parameters, the second time it is called we get no parameters and the MVC engine throws an exception because the arguments to the method cannot be null. 第一次调用它时,我们会获得正确的参数,第二次调用时,我们将没有参数,并且MVC引擎会引发异常,因为该方法的参数不能为null。

We have seen this behaviour before when using certain versions of Safari and it was to do with authentication. 在使用某些版本的Safari之前,我们已经看到了这种现象,这与身份验证有关。 When using windows authentication if the properties of the authentication in IIS were set to Negotiate and NTLM an ajax call would get sent once for each. 使用Windows身份验证时,如果IIS中的身份验证属性设置为Negotiate和NTLM,则每个Ajax调用将发送一次。 The fix for this was to remove one (I think we just left it as NTLM). 解决此问题的方法是删除一个(我想我们只是将其保留为NTLM)。 This is not the case as we are using forms authentication here. 情况并非如此,因为我们在这里使用表单身份验证。

We have also seen similar behaviour when calling WCF methods that were returning types that were derived and not using the KnownType attributes on the parent class. 当调用返回返回的派生类型并且不使用父类上的KnownType属性的WCF方法时,我们也看到了类似的行为。

We cannot reproduce this with any success (it's happening infrequently on a clients machine) and are looking for any general gotchas. 我们无法成功复制它(它很少在客户端计算机上发生),并且正在寻找任何一般的陷阱。

The reason the call is being called twice is because of a bug in Safari when working with Windows Authentication under IIS. 调用两次的原因是由于在IIS下使用Windows身份验证时Safari中存在错误。 Go to the Authentication settings of your website. 转到网站的身份验证设置。 Right click on Windows Authentication, choose providers and remove Negotiate, leaving NTLM which works fine. 右键单击Windows身份验证,选择提供程序并删除Negotiate,使NTLM正常运行。 I haven't tested Kerberos. 我尚未测试Kerberos。

This issue only appears in certain builds of safari. 仅在某些版本的野生动物园中出现此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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