[英]Type 'Startup' already defines a member called 'Configuration' with the same parameter types
I have this on my startup.cs 我在我的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);
}
}
}
and I have this Startup.Auth.cs 我有这个Startup.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
});
}
}
}
Howevver it does not compile with this error: 但是它不能用这个错误编译:
I use the code from this page http://tech.trailmax.info/2016/03/using-owin-and-active-directory-to-authenticate-users-in-asp-net-mvc-5-application/ 我使用此页面中的代码http://tech.trailmax.info/2016/03/using-owin-and-active-directory-to-authenticate-users-in-asp-net-mvc-5-application/
Easy, but hard to find, the problem is another developer created a startup.cs file with same signature in a different folder in the project structure. 容易但很难找到,问题是另一个开发人员在项目结构的不同文件夹中创建了一个具有相同签名的startup.cs文件。 Will leave evidence here because it might be useful for another developer 这里会留下证据,因为它可能对其他开发人员有用
You could have to constructors members in Startup class like this: 您可能必须在Startup类中构造成员,如下所示:
public class Startup {
public Startup(IConfiguration _configuration){
this._configuration = _configuration;
}
private IConfiguration _configuration{
get;
}
public Startup(IConfiguration configuration){
// Expose the injected instance locally so we populate our settings instance
_configuration = configuration;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.