-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
39 lines (33 loc) · 1.21 KB
/
Program.cs
File metadata and controls
39 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using OcppLogging;
using Server.Core.Helpers;
using Server.Core.Services.Ocpp;
public class Program
{
private static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<ILogWriter, LogWriter>();
builder.Services.AddWebSocketManager();
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddAuthentication("BasicAuthentication")
.AddScheme<BasicAuthenticationOptions, BasicAuthenticationHandler>("BasicAuthentication", (o) => { });
builder.Services.AddAuthorization();
var app = builder.Build();
WebSocketOptions webSocketOptions = new WebSocketOptions()
{
KeepAliveInterval = TimeSpan.FromSeconds(120)
};
app.UseAuthentication();
app.UseAuthorization();
app.UseWebSockets(webSocketOptions);
app.UseWebSocketMiddleware("/ocpp201",
app.Services.GetService<OcppMessageHandler>());
app.UseRouting();
app.UseStaticFiles();
app.MapBlazorHub();
app.MapRazorPages();
app.Run();
}
}