UseFileServer()的使用NETCORE设置默认静态资
作者:
醉酒的姑娘 | 来源:发表于
2021-01-11 11:22 被阅读0次 //识别wwwroot目录下的任何静态资源文件,默认打开index.html页面
app.UseFileServer();

image.png
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
//app.UseHttpsRedirection();
app.UseStaticFiles();
//app.UseCookiePolicy();
//会识别wwwroot目录下的任何静态资源文件,默认打开index.html页面
app.UseFileServer();
//mvc的路由设置
//app.UseMvc(routes =>
//{
// //routes.MapRoute(
// // name: "default",
// // template: "{controller=Home}/{action=Index}/{id?}");
//});
}

image.png
本文标题:UseFileServer()的使用NETCORE设置默认静态资
本文链接:https://www.haomeiwen.com/subject/qoaraktx.html
网友评论