2 Star 1 Fork 1

JamesYeung / iview-aspnetcore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Startup.cs 1.96 KB
一键复制 编辑 Web IDE 原始数据 按行查看 历史
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace iview_aspnetcore
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
// app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
// {
// HotModuleReplacement = true
// });
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseDefaultFiles();
app.Use(async (context, next) =>
{
await next();
if (context.Response.StatusCode >= 400)
{
context.Response.StatusCode = 200;
await context.Response.SendFileAsync("wwwroot/index.html");
}
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}
JavaScript
1
https://gitee.com/JamesYeung/iview-aspnetcore.git
git@gitee.com:JamesYeung/iview-aspnetcore.git
JamesYeung
iview-aspnetcore
iview-aspnetcore
master

搜索帮助

14c37bed 8189591 565d56ea 8189591