似乎在某些时候出现了一个问题,人们追踪到该问题导致当服务器具有不同的补丁组合时身份验证票证在 Webfarm 上被标记为无效。
不幸的是,即使 web 服务器上有相同的补丁,似乎仍然存在问题。
我的两台服务器:
- 有相同的补丁
- 具有相同的机器 key
然而,当用户从场中的一个 Web 服务器转换到另一个 Web 服务器时,底层 Microsoft 代码会使 token 无效。这是事件日志条目:
Event code: 4005
Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid.
Event time: 4/10/2012 2:42:20 PM
Event time (UTC): 4/10/2012 6:42:20 PM
Event ID: 92eedee52ede49239fd063fe5609d858
Event sequence: 2
Event occurrence: 1
Event detail code: 50201
Application information:
Application domain: /LM/W3SVC/2000/ROOT-1-129785553216092727
Trust level: Full
Application Virtual Path: /
Application Path: C:\inetpub\wwwroot\testportal.mydomain.com\
Machine name: WEB02
Process information:
Process ID: 1428
Process name: w3wp.exe
Account name: IIS APPPOOL\testportal.mydomain.com
Request information:
Request URL: http://testportal.mydomain.com/Interface.aspx
Request path: /Interface.aspx
User host address: *************
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\testportal.mydomain.com
Name to authenticate:
Custom event details:
我要么必须解决这个问题,要么从我的系统中编写微软的身份验证(我真的没有时间去做)。
以下是同样应用于两台服务器的修补程序:
基于 Windows Server 2008 R2 x64
KB981391,KB981392,KB977236,KB981111,KB977238,KB977239,KB981390,KB2305420,KB2386667,KB2393802,KB2425227,KB2475792,KB2476490,KB2478662,KB2479628,KB2482017,KB2484033,KB2485376,KB2487426,KB2488113,KB2492386,KB2503665,KB2505438,KB2506014 ,KB2506212,KB2506928,KB2507618,KB2507938,KB2508272,KB2509553,KB2510531,KB2511250,KB2511455,KB2515325,KB2518869,KB2522422,KB2524375,KB2529073,KB2530548,KB2533552,KB2533623,KB2534366,KB2536275,KB2536276,KB2539635,KB2541014,KB2544521,KB2544893,KB2545698 ,KB2547666,KB2552343,KB2555917,KB2556532,KB2560656,KB2563227,KB2564958,KB2567680,KB2570947,KB2572077,KB2584146,KB2585542,KB2588516,KB2598845,KB2603229,KB2607047,KB2607576,KB2608658,KB2618444,KB2618451,KB2620704,KB2620712,KB2621440,KB2631813,KB2632503 ,KB2633873,KB2633952,KB2636573,KB2639308,KB2639417,KB2640148,KB2641653,KB2641690,KB2643719,KB2644615,KB2645640,KB2647516,KB2647518,KB2654428,KB2656356,KB2660075,KB2660465,KB2665364,KB2667402,KB958488,KB976902,KB976932,KB982018
根据请求,这是我的 web.config 的身份验证部分:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name=".ASPXFORMSAUTH" cookieless="AutoDetect" timeout="120" slidingExpiration="true">
</forms>
</authentication>
最佳答案
我想我终于解决了这个问题。我不确定为什么此更改可以解决问题,但我为解决此问题所做的是将 machineKey 定义直接放在我的应用程序的 web.config 文件中。显然,要么我不明白如何使用 IIS 管理器正确设置机器 key ,要么 IIS 管理器存在一些问题。
所以为了解决这个问题,我直接在我的 web.config 中添加了一个看起来像这样的条目:
<machineKey validation="SHA1" validationKey="-a-validation-key-" decryption="Auto" decryptionKey="-a-decryption-key-"/>
这篇文章让我找到了解决这个问题的正确途径:
关于asp.net - Microsoft 似乎仍然存在 WebFarm 上的表单例份验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10094772/