Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1516

Troubleshooting HTTPS Issues with .NET Application on IIS Server

$
0
0

i have a IIS Server with all installed bundles and co ...If i run the build locally https works and on server there is nothing. Via PortScanner i see it opened port and EventManger shows me process started.Via http i can see all and it works there but not on https.

i have on same IIS same ssl certificate the frontend with vue3 and it works fine...But not the .net app here...Where the hell is my mistake?

Program.cs

using BaseBackend.Controllers;using Microsoft.AspNetCore.Authentication.Cookies;var builder = WebApplication.CreateBuilder(args);// Add services to the container.builder.Services.AddControllersWithViews(); // For MVC supportbuilder.Services.AddControllers(); // For API support// Configure Swagger/OpenAPIbuilder.Services.AddEndpointsApiExplorer();builder.Services.AddSwaggerGen();// Register IConfiguration for DI//builder.Services.AddSingleton<IConfiguration>(builder.Configuration);// Register TuningDatabaseHandler for DIbuilder.Services.AddScoped<TuningDatabaseHandler>();builder.Services.AddScoped<MyUploadedFileHandler>();builder.Services.AddScoped<StringReplacementHandler>();builder.Services.AddScoped<TaskHandler>();builder.Services.AddScoped<EcuHandler>();// Configure Authenticationbuilder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)    .AddCookie(options =>    {        options.LoginPath = "/api/login";        options.LogoutPath = "/api/logout";        options.Cookie.HttpOnly = true;    });// Configure Authorizationbuilder.Services.AddAuthorization();// Configure CORSbuilder.Services.AddCors(options =>{    options.AddPolicy("AllowFrontend", builder =>    {        builder.WithOrigins("https://localhost")               .AllowAnyHeader()               .AllowAnyMethod()               .AllowCredentials();    });});builder.Services.AddHttpsRedirection(options =>{    options.HttpsPort = 44390; // Specify the HTTPS port where is same in IIS});var app = builder.Build();// Configure the HTTP request pipeline.app.UseSwagger();app.UseSwaggerUI();// Enable CORS policyapp.UseCors("AllowFrontend");//app.UseHttpsRedirection();// Use authentication and authorization middlewareapp.UseAuthentication();app.UseAuthorization();app.MapControllers();app.MapGet("/", () => "Test Page: Application is Running!");app.Run();

appsettings.json

{"Logging": {"LogLevel": {"Default": "Information","Microsoft.AspNetCore": "Warning"        }    },"AllowedHosts": "*","Swagger": {"Enabled": true      },"ConnectionStrings": {"dbo": "Server=.\\SQLEXPRESS;Integrated Security=True;Database=dbo;"      },"Kestrel": {"Endpoints": {"Https": {"Url": "https://localhost:44390" // Set HTTPS to listen on port 44390          }        }    }}

Viewing all articles
Browse latest Browse all 1516

Trending Articles