Taurus.MVC_NetCore :.NET Core 版本,一般部署在 Linux 平台,建议:VS2017 以上,当前最新VS2022。
框架的运行注意点:.Net Core 版本通过配置服务添加和使用引用 Taurus。
publicvoid ConfigureServices(IServiceCollection services)
{
services.AddTaurusMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.publicvoid Configure(IApplicationBuilder app, IWebHostEnvironment env)//把 IHostingEnvironment IWebHostEnvironment {
app.UseTaurusMvc();
}
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddTaurusMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseTaurusMvc();
}
}
3、NET5、NET6、NET7、NET8...系列,通过Program.cs 配置入口:
var builder = WebApplication.CreateBuilder(args);
//补上Starpup的ConfigureServices:
builder.Services.AddTaurusMvc();
var app = builder.Build();
app.UseTaurusMvc();
app.Run();
评论区