42 lines
982 B
C#
42 lines
982 B
C#
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
var configuration = builder.Configuration;
|
|
// Add services to the container.
|
|
builder.Services.AddControllersWithViews();
|
|
builder.Services.AddRemoteRequest(options =>
|
|
{
|
|
//合泰八电极算法地址
|
|
options.AddHttpClient("hetai", c =>
|
|
{
|
|
c.BaseAddress = new Uri(configuration["BodyApiSettings:BaseUrl"]);
|
|
})
|
|
.ConfigurePrimaryHttpMessageHandler(u => new HttpClientHandler
|
|
{
|
|
// 忽略 SSL 不安全检查,或 https 不安全或 https 证书有误
|
|
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
|
|
})
|
|
;
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllerRoute(
|
|
name: "default",
|
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
|
|
app.Run();
|