init website

This commit is contained in:
hogan
2018-12-27 16:56:23 +08:00
parent 433c2d2b2d
commit a30529db14
9 changed files with 38 additions and 3 deletions

View File

@ -9,6 +9,7 @@ using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json.Serialization;
namespace FreeSql.Site.UI
{
@ -32,6 +33,21 @@ namespace FreeSql.Site.UI
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
//设置返回内容得大小写格式
.AddJsonOptions(options => { options.SerializerSettings.ContractResolver = new DefaultContractResolver(); });
//Session服务
services.AddSession();
//添加跨域访问
services.AddCors(options => options.AddPolicy("AllowAnyOrigin",
builder => builder.WithOrigins("*")
.AllowAnyMethod()
.AllowAnyHeader()
.AllowAnyOrigin()
.AllowCredentials()));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}