C# 错误CS0122 ';认证选项';由于其保护级别,无法访问

C# 错误CS0122 ';认证选项';由于其保护级别,无法访问,c#,inheritance,visual-studio-2015,owin,katana,C#,Inheritance,Visual Studio 2015,Owin,Katana,我一直在关注这个 现在我在编写AuthenticationOptions时遇到了一个问题。 当我从Microsoft.Owin.Security.AuthenticationOptions访问时,我得到“由于其保护级别而无法访问”。问题是这个类是受保护的,所以它不应该是不可访问的?我已经尝试过进行清理和重建,但仍然出现同样的错误。我一定错过了什么 我的班级: using Microsoft.Owin; using Microsoft.Owin.Security; using System; us

我一直在关注这个

现在我在编写AuthenticationOptions时遇到了一个问题。 当我从Microsoft.Owin.Security.AuthenticationOptions访问时,我得到“由于其保护级别而无法访问”。问题是这个类是受保护的,所以它不应该是不可访问的?我已经尝试过进行清理和重建,但仍然出现同样的错误。我一定错过了什么

我的班级:

using Microsoft.Owin;
using Microsoft.Owin.Security;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dummy
{
    public class DummyAuthenticationOptions : AuthenticationOptions
    {
        public DummyAuthenticationOptions(string userName, string userId)
            : base(Constants.DefaultAuthenticationType)
        {
            Description.Caption = Constants.DefaultAuthenticationType;
            CallbackPath = new PathString("/signin-dummy");
            AuthenticationMode = AuthenticationMode.Passive;
            UserName = userName;
            UserId = userId;
        }

        public PathString CallbackPath { get; set; }

        public string UserName { get; set; }

        public string UserId { get; set; }

        public string SignInAsAuthenticationType { get; set; }

        public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }
    }
}

问题是
AuthenticationOptions
类被设置为internal。我将
Microsft.Owin.Security
包从3.0.1降级到2.0.1。在这里,这个类被标记为
public
,因此我可以毫无问题地编译


多亏了Dmitry Rotay

,问题在于
AuthenticationOptions
类被设置为internal。我将
Microsft.Owin.Security
包从3.0.1降级到2.0.1。在这里,这个类被标记为
public
,因此我可以毫无问题地编译


多亏了Dmitry Rotay

Innal类只能从声明它们的程序集中访问。您确定使用的Microsoft.Owin.Security版本与本文作者使用的版本相同吗?我刚刚从github打开了作者示例的源代码,那里的一切看起来都很好。而
AuthenticationOptions
类在该版本的库(2.0.1+)中是公共的。我使用的是最新的稳定版本(3.0.1)。如果有帮助的话,我会和nuget一起拿到包裹。我降级到2.0.1,并编译了它。我想问题是这个类是内部的,而不是在2.0.1中,我想知道为什么?感谢您的帮助:)只能从声明内部类的程序集中访问内部类。您确定使用的Microsoft.Owin.Security版本与本文作者使用的版本相同吗?我刚刚从github打开了作者示例的源代码,那里的一切看起来都很好。而
AuthenticationOptions
类在该版本的库(2.0.1+)中是公共的。我使用的是最新的稳定版本(3.0.1)。如果有帮助的话,我会和nuget一起拿到包裹。我降级到2.0.1,并编译了它。我想问题是这个类是内部的,而不是在2.0.1中,我想知道为什么?谢谢你帮我:)
namespace Microsoft.Owin.Security
{
    internal abstract class AuthenticationOptions
    {
        protected AuthenticationOptions(string authenticationType);

        public AuthenticationMode AuthenticationMode { get; set; }
        public string AuthenticationType { get; set; }
        public AuthenticationDescription Description { get; set; }
    }
}