I am currently running the domain catgenesim.com, and I have the frontend configured. The backend says that it is running, but whenever I try to hit anything on the backend, it just times out after a while.
I have added breakpoints in Visual Studio, but they never get hit, so clearly nothing is going through.
Here is my Program.cs
using System.Net;
using System.Net.Sockets;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using LettuceEncrypt;
var builder = WebApplication.CreateBuilder(args);
// Configure Kestrel and LettuceEncrypt
builder.WebHost.ConfigureKestrel(kestrel =>
{
kestrel.ListenAnyIP(49155, portOptions =>
{
portOptions.UseHttps(h =>
{
h.UseLettuceEncrypt(kestrel.ApplicationServices);
});
});
});
// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddLettuceEncrypt();
// Add CORS policy
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAll",
policy => policy.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader());
});
// Configure logging
builder.Logging.ClearProviders();
builder.Logging.AddConsole();
builder.Logging.AddDebug();
builder.Logging.AddEventSourceLogger();
builder.WebHost.UseSockets(socketOptions => {
socketOptions.CreateBoundListenSocket = endpoint => {
var ip = (IPEndPoint)endpoint;
var listenSocket = new Socket(ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
if (ip.Address.Equals(IPAddress.IPv6Any))
{
listenSocket.DualMode = true;
}
listenSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
listenSocket.Bind(endpoint);
return listenSocket;
};
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
// Use CORS policy
app.UseCors("AllowAll");
app.UseAuthorization();
app.UsePathBase("/api");
app.MapControllers();
app.Run();
And my appsettings.json, with my email removed for my privacy
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://catgenesim.com:5000"
},
"Https": {
"Url": "https://catgenesim.com:5001"
}
},
"LettuceEncrypt": {
// Set this to automatically accept the terms of service of your certificate authority.
// If you don't set this in config, you will need to press "y" whenever the application starts
"AcceptTermsOfService": true,
// You must specify at least one domain name
"DomainNames": [ "catgenesim.com" ],
// You must specify an email address to register with the certificate authority
"EmailAddress": "EMAIL"
}
}
}
This is what I see when I run the program.