forked from dtm-labs/client-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (29 loc) · 1.12 KB
/
Program.cs
File metadata and controls
36 lines (29 loc) · 1.12 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
using BusiIntegrationService;
using BusiIntegrationService.Services;
using Dtmcli;
using Dtmgrpc;
using Microsoft.AspNetCore.Server.Kestrel.Core;
// Enable HTTP/2 support for unencrypted HTTP connections (required for gRPC over HTTP)
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddGrpc(options =>
{
// Configure gRPC to allow unencrypted HTTP/2 connections (for local development)
options.EnableDetailedErrors = true;
});
builder.Services.AddDtmGrpc(x =>
{
x.DtmGrpcUrl = "http://localhost:36790";
});
builder.Services.AddDtmcli(option =>
{
option.DtmUrl = "http://localhost:36789";
});
// Add controllers for HTTP API
builder.Services.AddControllers();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.MapGrpcService<BusiApiService>();
app.MapControllers(); // Map the HTTP API controllers
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
app.Run();