Furion设置AppStartup顺序导致Swagger文档404
一个刚创建的干净的Furion项目,其中WebApi项目依赖了个ApiBase的项目,两个项目均有Startup.cs文件
其中ApiBase的Startup.cs类如下:
[AppStartup
(99)] //先执行
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddJwt<JwtHandler>();
services.AddCorsAccessor();
services.AddControllers()
.AddInject();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseCorsAccessor();
app.UseAuthentication();
app.UseAuthorization();
app.UseInject(string.Empty);
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
而WebApi项目的Startup.cs文件
[AppStartup
(10)] //后执行
public class Startup
{
/// <summary>
///
/// </summary>
/// <param name="services"></param>
public void ConfigureServices(IServiceCollection services)
{
services.AddSchedule(options =>
{
options.AddJob<CredentialFileMonitor>(Triggers.DailyAt(10));
});
}
public void Configure(IApplicationBuilder app)
{
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
}
}
Program.cs就一句代码
Serve.Run(RunOptions.Default.WithArgs(args));
调试运行本该显示出swagger文档,结果显示404,将[AppStartup(x)]特性删除,改成Startup:AppStartup后,正常显示swagger文档