c# - 类型 'Startup' 已经定义了一个名为 'Configuration' 的成员,具有相同的参数类型

标签 c# asp.net asp.net-mvc owin

我的 startup.cs 上有这个

using Microsoft.Owin;
using Owin;

[assembly: OwinStartupAttribute(typeof(xx.yy.Startup))]
namespace xx.yy
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
        }
    }
}

我有这个 启动.Auth.cs

using System;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;

namespace xx.yy
{
    public static class xxAuthentication
    {
        public const String ApplicationCookie = "xxAuthenticationType";
    }

    public partial class Startup
    {
        public void ConfigureAuth(IAppBuilder app)
        {
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = xxAuthentication.ApplicationCookie,
                LoginPath = new PathString("/Login"),
                Provider = new CookieAuthenticationProvider(),
                CookieName = "ComisionesCookie",
                CookieHttpOnly = true,
                ExpireTimeSpan = TimeSpan.FromHours(12), // adjust to your needs
            });
        }
    }
}

但是它不会编译并出现此错误:

Image

我使用这个页面的代码 http://tech.trailmax.info/2016/03/using-owin-and-active-directory-to-authenticate-users-in-asp-net-mvc-5-application/

最佳答案

问题很简单,但很难找到,因为另一个开发人员在项目结构的不同文件夹中创建了一个具有相同签名的 startup.cs 文件。将在此处留下证据,因为它可能对其他开发人员有用

关于c# - 类型 'Startup' 已经定义了一个名为 'Configuration' 的成员,具有相同的参数类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37617877/

相关文章:

asp.net - web.config 中的绝对或相对文件路径

c# - EF 迁移应该去哪里,我的类库项目还是我的 ASP.NET 项目?

c# - 有没有办法在没有异常类的情况下抛出自定义异常

asp.net-mvc - 保护ASP.NET MVC应用程序进行beta测试的安全?

c# - 在 case 语句中检测到无法访问的代码

c# - 有没有更好的方法来创建多维强类型数据结构?

c# - NuGet:在项目中将包依赖项显式列出为包引用,以便可以卸载它们

c# - 字符串缺少终止符 : "

c# - 如何在 ASP.Net MVC 5 中跟踪匿名用户的事件?

asp.net-mvc - Nopcommerce 新表服务注册错误