本文介绍了找到具有意外名称"Cascading AuthenticationState"的标记元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在App.razor上遇到此错误:

I am getting this error on my App.razor:

这是我正在使用的代码

<CascadingAuthenticationState>
    <Router AppAssembly="@typeof(Program).Assembly">
        <Found Context="routeData">
            <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
        </Found>
        <NotFound>
            <LayoutView Layout="@typeof(MainLayout)">
                <p>Sorry, there's nothing at this address.</p>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>

我正在使用Visual Studio 2019预览版,可以运行该应用程序,但是为什么级联中有红线...?谢谢您的帮助.

I am using Visual Studio 2019 preview and I can run the application but, why do I have the red line in the Cascading....? Thank you for your help.

推荐答案

对我来说,向_Imports.razor添加两个引用都可以解决同一问题:

For me adding both references to _Imports.razor worked to solve same issue:

@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization

这篇关于找到具有意外名称"Cascading AuthenticationState"的标记元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 01:56
查看更多