mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
init website
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user