Open loveksmy opened 1 year ago
Try this:
builder.Host.AsMultipleServerHostBuilder()
.AddServer<StringPackageInfo, CommandLinePipelineFilter>(builder =>
{
builder...;
})
.AsMinimalApiHostBuilder()
.ConfigureHostBuilder();
不行哦。 “MultipleServerHostBuilder”不包含“AsMinimalApiHostBuilder”的定义,并且最佳扩展方法重载“HostBuilderExtensions.AsMinimalApiHostBuilder(ISuperSocketHostBuilder)”需要类型为“SuperSocket.ISuperSocketHostBuilder”的接收器
I am trying to support it https://github.com/kerryjiang/SuperSocket/commit/b7d89c4e52b6fb59d8f9c19a14b770f6c626a4e8
It supposes to work like this:
builder.Host.AsMultipleServerHostBuilder()
.AddServer<StringPackageInfo, CommandLinePipelineFilter>(builder =>
{
builder...;
})
.AsMinimalApiHostBuilder()
.ConfigureHostBuilder();
var app = builder.Build();
app.AdaptMultipleServerHost();
await app.RunAsync();
nuget thank you
不行哦。还是这个错误 “MultipleServerHostBuilder”不包含“AsMinimalApiHostBuilder”的定义,并且最佳扩展方法重载“HostBuilderExtensions.AsMinimalApiHostBuilder(ISuperSocketHostBuilder)”需要类型为“SuperSocket.ISuperSocketHostBuilder”的接收器
Get latest packages from MyGet.
` var builder = WebApplication.CreateBuilder(args);
builder.Host.AsMultipleServerHostBuilder()
.AddServer<StringPackageInfo, CommandLinePipelineFilter>(tcpServer =>
{
tcpServer.ConfigureSuperSocket(op =>
{
op.Listeners = new List<ListenOptions>() { new ListenOptions() {
Ip="Any", Port=5555
}};
});
})
.AsMinimalApiHostBuilder()
.ConfigureHostBuilder();
// Add services to the container.
builder.Services.AddControllers();
var app = builder.Build();
app.AdaptMultipleServerHost();
// Configure the HTTP request pipeline.
app.UseAuthorization();
app.MapControllers();
app.Run();
`
我用了最新源码,还是报错 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 CS1929 “MultipleServerHostBuilder”不包含“AsMinimalApiHostBuilder”的定义,并且最佳扩展方法重载“HostBuilderExtensions.AsMinimalApiHostBuilder(ISuperSocketHostBuilder)”需要类型为“SuperSocket.ISuperSocketHostBuilder”的接收器 WebApplication1 (net7.0)
Added a missing method, please try again with latest source code or latest package from myget.
非常感谢,已经成功。
builder.Host.AsMultipleServerHostBuilder() .AddServer<MyServiceA, StringPackageInfo, CommandLinePipelineFilter> .AddServer<MyServiceB, StringPackageInfo, CommandLinePipelineFilter>
这样可以成功添加并启动2个服务。
但是不带MyServiceA和MyServiceB后,只能启动第一个服务。
builder.Host.AsMultipleServerHostBuilder() .AddServer< StringPackageInfo, CommandLinePipelineFilter> .AddServer< StringPackageInfo, CommandLinePipelineFilter>
不知道用这种动态服务的场景多吗?有没其他处理办法。
谢谢
` var builder = WebApplication.CreateBuilder(args);
`
这样写不能正确启动。