We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using System; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using PluginCore.IPlugins; namespace WebSocketDemoPlugin { public class WebSocketDemoPlugin : BasePlugin, IStartupXPlugin { public override (bool IsSuccess, string Message) AfterEnable() { Console.WriteLine($"{nameof(WebSocketDemoPlugin)}: {nameof(AfterEnable)}"); return base.AfterEnable(); } public override (bool IsSuccess, string Message) BeforeDisable() { Console.WriteLine($"{nameof(WebSocketDemoPlugin)}: {nameof(BeforeDisable)}"); return base.BeforeDisable(); } public void ConfigureServices(IServiceCollection services) { } public void Configure(IApplicationBuilder app) { var webSocketOptions = new WebSocketOptions() { // KeepAliveInterval - 向客户端发送 "ping" 帧的频率,以确保代理保持连接处于打开状态。 默认值为 2 分钟。 KeepAliveInterval = TimeSpan.FromSeconds(120), }; app.UseWebSockets(webSocketOptions); } public int ConfigureOrder { get { return 2; } } public int ConfigureServicesOrder { get { return 2; } } } }
当执行 _components[c](app) 报 System.NullReferenceException: 'Object reference not set to an instance of an object.'
_components[c](app)
System.NullReferenceException: 'Object reference not set to an instance of an object.'
_components[0] 不为 null, 是内部,当 _components[0]() 执行 Func<RequestDelegate, RequestDelegate> 委托时,才报错
_components[0]
_components[0]()
Func<RequestDelegate, RequestDelegate>
The text was updated successfully, but these errors were encountered:
猜测,ApplicationBuilder 还是需要 IServiceProvider ,可能需要什么 Service,
ApplicationBuilder
IServiceProvider
但奇怪的是,之前做过的实验, IPluginFinder 却可以正常从 Middleware 的 InvokeAsync 方法上,通过依赖注入获取
IPluginFinder
Middleware
InvokeAsync
Sorry, something went wrong.
No branches or pull requests
当执行
_components[c](app)
报System.NullReferenceException: 'Object reference not set to an instance of an object.'
_components[0]
不为 null, 是内部,当_components[0]()
执行Func<RequestDelegate, RequestDelegate>
委托时,才报错The text was updated successfully, but these errors were encountered: