i getting HTTP Error 404 after upgrade my application from .Net 5 to .Net 8. API side is running fine but Client side having error. I tried to create new application and copy the launchSetting from existing project to the new project and new project running fine. I had also update my dependencies to latest version but somehow it’s not working. Anyone facing the same issue that can advise?
Log captured in VS
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished HTTP/1.1 GET http://localhost:12345/ – 404 – – 139.5805ms
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request reached the end of the middleware pipeline without being handled by application code. Request path: GET http://localhost:12345/, Response status code: 404
**Startup.cs**
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IGlobalAccessRepo, GlobalAccessRepo>();
services.Configure<CookiePolicyOptions>(options =>
{
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddDistributedMemoryCache();
services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromSeconds(900); //Allow idle for 15 mins
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
});
services.AddSingleton<IDataValidation, DataValidation>();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
System.Text.Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
services.AddRazorPages();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseSession();
app.UseXXssProtection(option => option.EnabledWithBlockMode());
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}");
});
}
}
**Program.cs**:
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[]
args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
3