找到具有意外名称"Cascading AuthenticationState"的标记元素 [英] Found markup element with unexpected name 'Cascading AuthenticationState'

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

问题描述

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

I am getting this error on my App.razor:

找到具有意外名称的标记元素 'CascadingAuthenticationState'.如果打算将其作为组件, 为其命名空间添加@using指令

Found markup element with unexpected name 'CascadingAuthenticationState'. If this is intended to be a component, add a @using directive for it namespace

这是我正在使用的代码

<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"的标记元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆