I added to my project that only logged in users where able to view my website. But now I want to make it so the user doesn't need to be logged in. I already removed thing that I added to my Startup class, and now it gives me an error saying "localhost:5000/Account/Login not found". Here is my startup class:
public class Startup
{
IConfiguration configuration;
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<IdentityUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
//.AddRoles<IdentityRole>()
services.AddControllersWithViews().AddNewtonsoftJson(options =>
options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
);
services.AddSignalR();
//services.AddControllersWithViews();
//services.AddRazorPages();
//services.AddControllers(config =>
//{
// // using Microsoft.AspNetCore.Mvc.Authorization;
// // using Microsoft.AspNetCore.Authorization;
// var policy = new AuthorizationPolicyBuilder()
// .RequireAuthenticatedUser()
// .Build();
// config.Filters.Add(new AuthorizeFilter(policy));
//});
//premite o acesso ao controller IgnicoesAPIController através dos outros controllers
services.AddTransient<IgnicoesAPIController, IgnicoesAPIController>();
services.AddTransient<OcorrenciasAPIController, OcorrenciasAPIController>();
services.AddSingleton<IConfiguration>(Configuration);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseAuthentication();
//SIGNAL R
//String caminho = configuration["AppSettings:Servidor"] + "/myHub";
String caminho = Configuration["AppSettings:Servidor"] + "/myHub";
//endpoints.MapHub<MyHub>(caminho);
//app.UseSignalR(route =>
//{
// route.MapHub<MyHub>(caminho);
//});
app.UseRouting();
// app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<MyHub>("/myHub");
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
//endpoints.MapRazorPages();
});
}
}
Am I missing something?