1-) .Net Core Web Api - ssl certificate doğrulama her apiye ekle mail gönderme vs her şeyin sıkıntısız çalışması için gerekli
Program.cs ye ekle
var builder = WebApplication.CreateBuilder(args);
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
ayrıca
app.UseCors çağrısını app.UseRouting'den sonra ve app.UseEndpoints'ten önce yaptığınızdan emin olun:
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseCors(builder => builder
.AllowAnyHeader()
.AllowAnyMethod()
.AllowAnyOrigin()
);
if (app.Environment.IsDevelopment() || app.Environment.IsProduction())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c =>
c.SwaggerEndpoint("/swagger/v1/swagger.json", "myapi v1");
});
}
app.UseEndpoints(endpoints =>
endpoints.MapControllers();
app.Run();