gpt4 book ai didi

asp.net - 数以千计的 TaskCanceledException 异常

转载 作者:可可西里 更新时间:2023-11-01 11:14:32 25 4
gpt4 key购买 nike

在大约 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 包都是最新的,我们的网络服务器也是如此。

最佳答案

您是否订阅或使用基本、标准或高级定价层 (Service Tier Comparison) 的 Azure Redis 缓存?我相信您遇到过缓存服务中断。高级层提供 Redis 集群,这将减少任何服务中断。标准层提供用于灾难恢复的复制,但需要通过应用程序中的重试 机制来缓解任何服务中断。基本层仅提供单个节点,没有复制或集群功能。

此外,请确保您正在通过类似的方法实现 HomeController 类,根据 this教程。

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,因为如果您订阅了高级层但仅指向集群中的一个实例,这很重要。

如果你investigate this issue并发现您看到超时或多个断开连接问题,以下 doc对这个具体问题有一些指导。

关于asp.net - 数以千计的 TaskCanceledException 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55810785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com