Giter VIP home page Giter VIP logo

Comments (4)

SmallChi avatar SmallChi commented on May 28, 2024

这种就是你使用的方式有问题?

from jt808gateway.

ahern2012 avatar ahern2012 commented on May 28, 2024

QueueServer代码

var builder = WebApplication.CreateBuilder(args).Inject();

// 配置服务
builder.Services
    .AddJT808Configure()
    .AddWebApiClientTool(builder.Configuration)
    .AddGateway(builder.Configuration)
    .AddServerKafkaMsgProducer(builder.Configuration)
    .AddServerKafkaMsgReplyConsumer(builder.Configuration)
    .AddServerKafkaSessionProducer(builder.Configuration)
    .AddTcp()
    .AddUdp();

builder.Services.AddCors(options =>
                   options.AddPolicy("jt808", builder =>
                   builder.AllowAnyMethod()
                          .AllowAnyHeader()
                          .AllowCredentials()
                          .SetIsOriginAllowed(o => true)));

// 配置WebHost
builder.WebHost.ConfigureKestrel((context, options) =>
{
    var jT808Configuration = context.Configuration.GetSection(nameof(JT808Configuration)).Get<JT808Configuration>();
    options.ListenAnyIP(jT808Configuration.WebApiPort);
});

// 添加控制器
builder.Services.AddControllers().AddInject();

var app = builder.Build();
app.UseCors();
app.UseAuthorization();
app.UseInject();
app.MapControllers().RequireCors("jt808");

await app.RunAsync();


var builder = WebApplication.CreateBuilder(args).Inject();

QueueService代码

var builder = WebApplication.CreateBuilder(args).Inject();
// 配置服务
builder.Services.AddJT808Configure()
            .AddClientKafka()
            .AddMsgConsumer(builder.Configuration)
            .AddMsgReplyProducer(builder.Configuration)
            .AddSessionConsumer(builder.Configuration)
            .AddReplyMessage<JT808QueueReplyMessageHandlerImpl>()
            .AddSessionNotice<JT808SessionNoticeServiceImpl>();



builder.Services.AddRemoteRequest();
builder.Services.AddHostedService<SendCommandJob>();
builder.Services.AddHostedService<AlarmMessageConsumerJob>();
// 添加控制器
builder.Services.AddControllers().AddInject();

var app = builder.Build();

app.UseInject();
app.MapControllers();

await app.RunAsync();

请大佬帮忙分析下哪里有不对

from jt808gateway.

SmallChi avatar SmallChi commented on May 28, 2024

是QueueServer代码有问题还是QueueService代码有问题,这个看不出来喔,你可以用dotnet的dump分析下是哪个对象引起的。

from jt808gateway.

ahern2012 avatar ahern2012 commented on May 28, 2024

好的,谢谢大佬

from jt808gateway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.