59 lines
2.4 KiB
C#
59 lines
2.4 KiB
C#
![]() |
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Autofac.Extensions.DependencyInjection;
|
|||
|
using Microsoft.AspNetCore.Hosting;
|
|||
|
using Microsoft.Extensions.Configuration;
|
|||
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
using Microsoft.Extensions.Hosting;
|
|||
|
using Microsoft.Extensions.Logging;
|
|||
|
using VOL.Core.Configuration;
|
|||
|
|
|||
|
using VOL.WebApi.Controllers.MqDataHandle;
|
|||
|
|
|||
|
namespace VOL.WebApi
|
|||
|
{
|
|||
|
public class Program
|
|||
|
{
|
|||
|
public static void Main(string[] args)
|
|||
|
{
|
|||
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|||
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|||
|
//CreateHostBuilder(args).Build().Run();
|
|||
|
var host = CreateHostBuilder(args).Build();
|
|||
|
#region kafka<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
//if (AppSetting.Kafka.UseConsumer)
|
|||
|
//{
|
|||
|
// using var scope = host.Services.CreateScope();
|
|||
|
// var testConsumer = scope.ServiceProvider.GetService<IKafkaConsumer<string, string>>();
|
|||
|
// testConsumer.Consume(res =>
|
|||
|
// {
|
|||
|
// Console.WriteLine($"recieve:{DateTime.Now.ToLongTimeString()} value:{res.Message.Value}");
|
|||
|
// //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD> <20><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>
|
|||
|
// bool bl = DataHandle.AlarmData(res.Message.Value);
|
|||
|
// //<2F>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>践<EFBFBD>ر<EFBFBD><D8B1><EFBFBD>ִ<EFBFBD><D6B4>Commit
|
|||
|
// return bl;
|
|||
|
// }, AppSetting.Kafka.Topics.TestTopic);
|
|||
|
//}
|
|||
|
#endregion
|
|||
|
host.Run();
|
|||
|
}
|
|||
|
|
|||
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
|||
|
Host.CreateDefaultBuilder(args)
|
|||
|
.ConfigureWebHostDefaults(webBuilder =>
|
|||
|
{
|
|||
|
webBuilder.ConfigureKestrel(serverOptions =>
|
|||
|
{
|
|||
|
serverOptions.Limits.MaxRequestBodySize = 10485760;
|
|||
|
serverOptions.Limits.MaxRequestLineSize = 81920; // 8 KB
|
|||
|
// Set properties and call methods on options
|
|||
|
});
|
|||
|
webBuilder.UseKestrel().UseUrls("http://*:9991");
|
|||
|
webBuilder.UseIIS();
|
|||
|
webBuilder.UseStartup<Startup>();
|
|||
|
}).UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
|||
|
}
|
|||
|
}
|