前一段时间我确实运行了身份支架,但是不久之后我又将其连同所有文件一起删除了。我确实打算稍后再将其恢复,但我不希望在该URL上使用它。
我尝试删除bin / obj,甚至将其移至另一台计算机。我的项目中的任何地方都没有register.cshtml文件,但是,我仍然可以访问Url,登录,更改密码等。
是什么导致URL可访问?如何禁用它?
public class Program
{
public static void Main(string[] args)
{
var builder = WebHost.CreateDefaultBuilder(args);
builder.UseStartup<Program>();
var build = builder.Build();
build.Run();
}
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddScoped(typeof(AdminBuilder));
var mvc = services.AddMvc();
mvc.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAuthentication();
app.UseCookiePolicy();
app.UseMvcWithDefaultRoute();
}
}
IdentityHostingStartup.cs
[assembly: HostingStartup(typeof(MyProjectWebsite.IdentityHostingStartup))]
namespace MyProjectWebsite
{
public class IdentityHostingStartup : IHostingStartup
{
public void Configure(IWebHostBuilder builder)
{
builder.ConfigureServices((context, services) =>
{
services.AddDbContext<MyProjectDbContext>();
services.AddDefaultIdentity<SMyProjectUser>().AddEntityFrameworkStores<MyProjectDbContext>();
});
}
}
}