Потратив последние 3 дня, пытаясь решить эту проблему, поэтому я прошу вашей помощи. Я уже перешел ко многим связанным вопросам от stackoverflow, за исключением того, что они отличаются .Net Core версия.
Я недавно обновил свой сайт с ASP.NET CORE 2.2 до ASP.NET CORE 3.0, но теперь я продолжаю получать HTTP Error 502.5 - Process Failure
на вебсайте. Вы можете увидеть страницу на http://www.esnapup.com.
Вот как выглядит Startup.cs:
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.AddAuthentication(IISServerDefaults.AuthenticationScheme);
services.AddDbContext<AppDbContext>();
services.AddTransient<IProductRepository, ProductRepository>();
services.AddTransient<ICategoryRepository, CategoryRepository>();
services.AddTransient<IFeedRepository, FeedRepository>();
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.AddDistributedMemoryCache();
services.AddSession(options =>
{
// Set a short timeout for easy testing.
options.IdleTimeout = TimeSpan.FromSeconds(10);
options.Cookie.HttpOnly = true;
// Make the session cookie essential
options.Cookie.IsEssential = true;
});
MvcOptions mvcOptions = new MvcOptions();
mvcOptions.EnableEndpointRouting = false;
services.AddMvc();
services.AddRazorPages();
}
// 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.EnvironmentName == "Development")
{
app.UseDeveloperExceptionPage();
app.UseStatusCodePages();
}
else
{
app.UseExceptionHandler("/Home/Error");
//app.UseExceptionHandler("/Raffaello/Index");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
//app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseSession();
//app.UseCookiePolicy();
app.UseRouting();
app.UseAuthentication();
app.UseEndpoints(routes =>
{
routes.MapControllerRoute(
name: "Details",
pattern: "{controller}/{Details}/{id?}",
new { controller = "Product", action = "Details" },
new { id = @"w+" });
routes.MapControllerRoute(
name: "Detail",
pattern: "{controller}/{index}/{Detail}/{id?}",
new { controller = "Product", action = "Detail", level = "index" },
new { id = @"w+" });
routes.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
routes.MapRazorPages();
});
//app.UseSitemapMiddleware();
}
Страница Program.cs выглядит следующим образом:
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace SnapupMVC
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseSetting(
WebHostDefaults.PreventHostingStartupKey, "true")
.UseStartup<Startup>();
});
}
}
Вот мои коды .csproj:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
600 True False False MvcControllerEmptyScaffolder root / Controller 1440 False CustomProfile true
Пожалуйста, помогите мне решить проблему.
Спасибо