File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 1919 </ItemGroup >
2020
2121 <ItemGroup >
22- <PackageReference Include =" Microsoft.AspNetCore.Authentication.JwtBearer" Version =" 3.1.4" />
23- <PackageReference Include =" Microsoft.AspNetCore.Cors" Version =" 2.2.0" />
24- <PackageReference Include =" Microsoft.AspNetCore.Rewrite" Version =" 2.2.0" />
25- <PackageReference Include =" Microsoft.AspNetCore.Server.Kestrel.Https" Version =" 2.2.0" />
26- <PackageReference Include =" Microsoft.VisualStudio.Web.CodeGeneration.Design" Version =" 3.1.3" />
27-
28- <PackageReference Include =" Swashbuckle.AspNetCore" Version =" 5.4.1" />
29- <PackageReference Include =" Swashbuckle.AspNetCore.Annotations" Version =" 5.4.1" />
30- <PackageReference Include =" Swashbuckle.AspNetCore.Swagger" Version =" 5.4.1" />
22+ <PackageReference Include =" Microsoft.AspNetCore.Authentication.JwtBearer" Version =" 3.1.9" />
23+ <PackageReference Include =" Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version =" 3.1.9" />
24+ <PackageReference Include =" Microsoft.VisualStudio.Web.CodeGeneration.Design" Version =" 3.1.4" />
25+
26+ <PackageReference Include =" Swashbuckle.AspNetCore" Version =" 5.6.3" />
27+ <PackageReference Include =" Swashbuckle.AspNetCore.Annotations" Version =" 5.6.3" />
28+ <PackageReference Include =" Swashbuckle.AspNetCore.Swagger" Version =" 5.6.3" />
3129 </ItemGroup >
3230
3331 <ItemGroup >
Original file line number Diff line number Diff line change @@ -41,13 +41,19 @@ public void ConfigureServices(IServiceCollection services)
4141 } ) ;
4242 AuthConfigurer . Configure ( services , Configuration ) ;
4343
44+ var origins = Configuration . GetSection ( "CorsUrls" ) . Value . Split ( "," ) ;
4445 services . AddCors ( options => options . AddPolicy ( _defaultCorsPolicyName ,
4546 builder =>
46- builder . AllowAnyOrigin ( )
47+ builder . WithOrigins ( origins )
4748 . AllowAnyHeader ( )
4849 . AllowAnyMethod ( ) . AllowCredentials ( )
4950 ) ) ;
50- services . AddControllers ( ) ;
51+ services . AddControllers ( )
52+ . AddNewtonsoftJson ( options =>
53+ {
54+ options . SerializerSettings . ReferenceLoopHandling = Newtonsoft . Json . ReferenceLoopHandling . Ignore ;
55+ options . SerializerSettings . DateFormatString = "yyyy-MM-dd HH:mm:ss" ;
56+ } ) ; ;
5157 services . AddSwaggerGen ( c =>
5258 {
5359 c . SwaggerDoc ( "v1" , new OpenApiInfo { Title = "APIJSON.NET" , Version = "v1" } ) ;
Original file line number Diff line number Diff line change 44 "ConnectionString" : " Server=192.168.2.25;Database=yunwei1.8;Uid=root;Pwd=xmjk;Port=3306;Character Set=utf8;"
55 //"ConnectionString": "Server=119.29.9.25;Port=3306;Database=test;Uid=root;Pwd=1q,2w.3e?;CharSet=UTF8;"
66 },
7+ "CorsUrls" : " http://localhost:5000,http://localhost5001" ,
78 "Authentication" : {
89 "JwtBearer" : {
910 "IsEnabled" : " true" ,
You can’t perform that action at this time.
0 commit comments