c# mvc todo list 使用 IHtmlHelper.Partial 可能会导致应用程序死锁
c# mvc todo list Use of IHtmlHelper.Partial may result in application deadlocks
/Users/fevzisahinler/Projects/Todo/Todo/Views/Shared/_Layout.cshtml(14,14):警告 MVC1000:使用 IHtmlHelper.Partial 可能会导致应用程序死锁。考虑使用 Tag Helper 或 IHtmlHelper.PartialAsync。 (MVC1000)(待办事项)
请帮帮我
我在共享下创建了 _form.cshtml 个文件,
里面_layout.cshtml
@Html.Partial("_Form")
我将 @Html.Partial("_Form") 添加到该部分,以便它显示在主页上,但出现错误
根据 documentation:
Rendering a partial using IHtmlHelper.Partial or IHtmlHelper.RenderPartial extension methods results in blocking calls. This may result in performance degradation and application dead locks issues due to thread pool starvation.
意味着如果您使用 @Html.Partial
,您可能会遇到性能问题,因为此调用是同步的。
因此,在您的情况下,应该是:
@await Html.PartialAsync("_Form")
或者...如果你想使用标签,你可以这样做:
<partial name="_Form" />
这 2 个选项是异步的,因此您的错误应该会消失。
/Users/fevzisahinler/Projects/Todo/Todo/Views/Shared/_Layout.cshtml(14,14):警告 MVC1000:使用 IHtmlHelper.Partial 可能会导致应用程序死锁。考虑使用
请帮帮我
我在共享下创建了 _form.cshtml 个文件,
里面_layout.cshtml @Html.Partial("_Form") 我将 @Html.Partial("_Form") 添加到该部分,以便它显示在主页上,但出现错误
根据 documentation:
Rendering a partial using IHtmlHelper.Partial or IHtmlHelper.RenderPartial extension methods results in blocking calls. This may result in performance degradation and application dead locks issues due to thread pool starvation.
意味着如果您使用 @Html.Partial
,您可能会遇到性能问题,因为此调用是同步的。
因此,在您的情况下,应该是:
@await Html.PartialAsync("_Form")
或者...如果你想使用标签,你可以这样做:
<partial name="_Form" />
这 2 个选项是异步的,因此您的错误应该会消失。