-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
31 lines (22 loc) · 1.15 KB
/
Program.cs
File metadata and controls
31 lines (22 loc) · 1.15 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
using XmlDataSourceProxy;
var builder = WebApplication.CreateBuilder(args);
// Run as a Windows service when started by SCM; no-op when run from console.
builder.Host.UseWindowsService(o => o.ServiceName = "XmlDataSourceProxy");
// Bind to loopback only by default. SSRS / Report Builder run on the same
// box. Override with --urls or the Urls config key if you must change it.
if (string.IsNullOrEmpty(builder.Configuration["urls"]) &&
string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNETCORE_URLS")))
{
builder.WebHost.UseUrls("http://localhost:5080");
}
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"))
.AddTransforms<JsonToXmlTransformProvider>();
var app = builder.Build();
app.UseMiddleware<DesignTimeQueryMiddleware>();
app.MapGet("/", () =>
"XmlDataSourceProxy is running. Configure routes under ReverseProxy in appsettings.json. " +
"Each proxied response is converted from JSON to XML for use as an SSRS/PBIRS XML data source. " +
"Append ?_query=1 to any proxied URL to receive a generated SSRS <Query> document instead of the data.");
app.MapReverseProxy();
app.Run();