在大约24小时的时间内,我们在一台特定的服务器上收到了针对所有页面加载的数千个错误。错误采用以下形式:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 4/20/2019 1:43:47 PM
Event time (UTC): 4/20/2019 1:43:47 PM
Event sequence: 554231
Event occurrence: 12592
Event detail code: 0
Process information:
Process ID: 6888
Process name: w3wp.exe
Account name: IIS APPPOOL\DefaultAppPool
Exception information:
Exception type: TaskCanceledException
Exception message: A task was canceled.
at StackExchange.Redis.ConnectionMultiplexer.Wait(Task task) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 543
at StackExchange.Redis.RedisSubscriber.StackExchange.Redis.ISubscriber.Subscribe(RedisChannel channel, Action`2 handler, CommandFlags flags) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisSubscriber.cs:line 471
at C3.Code.Controls.Application.Caching.Redis.PubSub.PubSubController.SubscribeToCacheKey(RedisChannel cacheKey, Action`2 onMessageReceived) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Redis\PubSub\PubSubController.cs:line 45
at C3.Code.Controls.Application.Caching.Manager.Manager.Callbacks.OnGotten[T](String cacheKey, CacheType fromType, T objectGot) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Callbacks.cs:line 99
at C3.Code.Controls.Application.Caching.Manager.Manager.Get[T](String key, Func`1 getFromExternFunction, Boolean skipLocalCaches) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Manager.cs:line 131
at C3.PageControls.Forums.TopicRender.Page_Load(Object sender, EventArgs e) in C:\Construct.net\Source\C3Alpha2\PageControls\Forums\TopicRender.ascx.cs:line 42
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Thread information:
Thread ID: 448
Thread account name: IIS APPPOOL\DefaultAppPool
Is impersonating: False
Stack trace: at StackExchange.Redis.ConnectionMultiplexer.Wait(Task task) in C:\projects\stackexchange-redis\src\StackExchange.Redis\ConnectionMultiplexer.cs:line 543
at StackExchange.Redis.RedisSubscriber.StackExchange.Redis.ISubscriber.Subscribe(RedisChannel channel, Action`2 handler, CommandFlags flags) in C:\projects\stackexchange-redis\src\StackExchange.Redis\RedisSubscriber.cs:line 471
at C3.Code.Controls.Application.Caching.Redis.PubSub.PubSubController.SubscribeToCacheKey(RedisChannel cacheKey, Action`2 onMessageReceived) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Redis\PubSub\PubSubController.cs:line 45
at C3.Code.Controls.Application.Caching.Manager.Manager.Callbacks.OnGotten[T](String cacheKey, CacheType fromType, T objectGot) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Callbacks.cs:line 99
at C3.Code.Controls.Application.Caching.Manager.Manager.Get[T](String key, Func`1 getFromExternFunction, Boolean skipLocalCaches) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Manager.cs:line 131
at C3.PageControls.Forums.TopicRender.Page_Load(Object sender, EventArgs e) in C:\Construct.net\Source\C3Alpha2\PageControls\Forums\TopicRender.ascx.cs:line 42
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
随后似乎会自行清除异常。迷失了可能导致这些错误的原因。有人知道原因吗?
我们的所有nuget软件包以及我们的网络服务器都是最新的。
答案 0 :(得分:0)
您是否以基本,标准或高级定价层(Service Tier Comparison)订阅或使用Azure Redis缓存?我相信您遇到了缓存服务中断。高级层提供Redis群集,这将减轻任何服务中断。标准层提供了用于灾难恢复的复制,但是任何服务中断都需要通过应用程序中的retry
机制来减轻。基本层仅提供一个节点,没有复制或群集功能。
另外,请确保按照this教程,通过类似的方法实现HomeController
类。
public ActionResult RedisCache()
{
ViewBag.Message = "A simple example with Azure Cache for Redis on ASP.NET.";
var lazyConnection = new Lazy<ConnectionMultiplexer>(() =>
{
string cacheConnection = ConfigurationManager.AppSettings["CacheConnection"].ToString();
return ConnectionMultiplexer.Connect(cacheConnection);
});
// Connection refers to a property that returns a ConnectionMultiplexer
// as shown in the previous example.
IDatabase cache = lazyConnection.Value.GetDatabase();
// Perform cache operations using the cache object...
// Simple PING command
ViewBag.command1 = "PING";
ViewBag.command1Result = cache.Execute(ViewBag.command1).ToString();
// Simple get and put of integral data types into the cache
ViewBag.command2 = "GET Message";
ViewBag.command2Result = cache.StringGet("Message").ToString();
ViewBag.command3 = "SET Message \"Hello! The cache is working from ASP.NET!\"";
ViewBag.command3Result = cache.StringSet("Message", "Hello! The cache is working from ASP.NET!").ToString();
// Demonstrate "SET Message" executed as expected...
ViewBag.command4 = "GET Message";
ViewBag.command4Result = cache.StringGet("Message").ToString();
// Get the client list, useful to see if connection list is growing...
ViewBag.command5 = "CLIENT LIST";
ViewBag.command5Result = cache.Execute("CLIENT", "LIST").ToString().Replace(" id=", "\rid=");
lazyConnection.Value.Dispose();
return View();
}
并且正在为缓存调用正确的FQDN,因为如果您订阅了Premium层但仅指向集群中的一个实例,这就很重要。
如果您investigate this issue发现超时或多个断开连接问题,则以下doc针对此特定问题提供了一些指导。