Skip to content

Commit d13a481

Browse files
author
shenyi
committed
1.0.7
add Cores & update dotnet2.2
1 parent 944ca01 commit d13a481

3 files changed

Lines changed: 27 additions & 12 deletions

File tree

src/server/MagCore.Server/MagCore.Server.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.2</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -10,8 +10,8 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" />
14-
<PackageReference Include="SystemCommonLibrary" Version="0.1.0" />
13+
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.2.0" />
14+
<PackageReference Include="SystemCommonLibrary" Version="0.2.0.7" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/server/MagCore.Server/Startup.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System.Threading.Tasks;
55
using Microsoft.AspNetCore.Builder;
66
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.AspNetCore.Mvc;
8+
using Microsoft.AspNetCore.Mvc.Cors.Internal;
79
using Microsoft.Extensions.Configuration;
810
using Microsoft.Extensions.DependencyInjection;
911
using Microsoft.Extensions.Logging;
@@ -23,17 +25,30 @@ public Startup(IConfiguration configuration)
2325
// This method gets called by the runtime. Use this method to add services to the container.
2426
public void ConfigureServices(IServiceCollection services)
2527
{
28+
services.AddCors(options => {
29+
options.AddPolicy("CorsPolicy", builder => {
30+
builder.AllowAnyOrigin()
31+
.AllowAnyHeader()
32+
.AllowAnyMethod()
33+
.AllowCredentials();
34+
});
35+
});
36+
services.Configure<MvcOptions>(options =>
37+
{
38+
options.Filters.Add(new CorsAuthorizationFilterFactory("CorsPolicy"));
39+
});
40+
2641
services.AddMvc();
2742
}
2843

2944
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
3045
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
3146
{
32-
//if (env.IsDevelopment())
33-
//{
34-
// app.UseDeveloperExceptionPage();
35-
//}
36-
47+
if (env.IsDevelopment())
48+
{
49+
app.UseDeveloperExceptionPage();
50+
}
51+
app.UseCors("CorsPolicy");
3752
app.UseMvc();
3853

3954
MagCore.Core.Server.Start("Maps");

src/server/UnitTest/UnitTest.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.2</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
11-
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
12-
<PackageReference Include="MSTest.TestFramework" Version="1.2.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
12+
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

0 commit comments

Comments
 (0)