Skip to content

Commit c41c28b

Browse files
committed
update samples to netcore3.1
1 parent e9890b9 commit c41c28b

File tree

23 files changed

+98
-5581
lines changed

23 files changed

+98
-5581
lines changed

samples/AdvancedChatRoom/AdvancedChatRoom.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.1</TargetFramework>
3+
<TargetFramework>netcoreapp3.1</TargetFramework>
44
<UserSecretsId>advancedchatroom</UserSecretsId>
55
<RootNamespace>Microsoft.Azure.SignalR.Samples.AdvancedChatRoom</RootNamespace>
66
<PackageVersion Condition=" '$(SDKVersion)' != '' ">$(SDKVersion)</PackageVersion>
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
14+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.11" />
1515
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.*" />
1616
</ItemGroup>
1717
</Project>

samples/AdvancedChatRoom/Startup.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void ConfigureServices(IServiceCollection services)
5555
};
5656
});
5757

58-
services.AddMvc();
58+
services.AddControllers();
5959
services.AddSignalR()
6060
.AddAzureSignalR(options =>
6161
{
@@ -69,12 +69,14 @@ public void ConfigureServices(IServiceCollection services)
6969
public void Configure(IApplicationBuilder app)
7070
{
7171
app.UseAuthentication();
72-
app.UseMvc();
72+
app.UseRouting();
7373
app.UseFileServer();
74-
app.UseAzureSignalR(routes =>
74+
app.UseAuthorization();
75+
app.UseEndpoints(endpoints =>
7576
{
76-
routes.MapHub<ChatJwtSampleHub>("/chatjwt");
77-
routes.MapHub<ChatCookieSampleHub>("/chatcookie");
77+
endpoints.MapControllers();
78+
endpoints.MapHub<ChatJwtSampleHub>("/chatjwt");
79+
endpoints.MapHub<ChatCookieSampleHub>("/chatcookie");
7880
});
7981
}
8082
}

samples/FlightMap/FlightMap.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.1</TargetFramework>
3+
<TargetFramework>netcoreapp3.1</TargetFramework>
44
<UserSecretsId>flightmap</UserSecretsId>
55
<RootNamespace>Microsoft.Azure.SignalR.Samples.FlightMap</RootNamespace>
66
<UserSecretsId>flightMap</UserSecretsId>
@@ -11,7 +11,6 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
1514
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.*" />
1615
</ItemGroup>
1716
</Project>

samples/FlightMap/README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,32 @@ In real world scenarios you can replace the web server and the blob storage with
2929
az signalr create --resource-group <resource_group_name> --name <signalr_name> --sku Standard_S1
3030
```
3131
32-
1. Create a web app using [Azure CLI].
32+
1. Create a web app using Azure CLI:
3333
3434
```
3535
az appservice plan create --name <plan_name> --resource-group <resource_group_name> --sku S1 --is-linux
3636
az webapp create \
3737
--resource-group <resource_group_name> --plan <plan_name> --name <app_name> \
38-
--runtime "dotnetcore|2.1"
38+
--runtime "dotnetcore|3.1"
3939
```
4040
4141
1. Deploy flight map to web app:
4242
43-
```
44-
az webapp deployment source config-local-git --resource-group <resource_group_name> --name <app_name>
45-
az webapp deployment user set --user-name <user_name> --password <password>
46-
47-
git init
48-
git remote add origin <deploy_git_url>
49-
git add -A
50-
git commit -m "init commit"
51-
git push origin master
52-
```
43+
a. Publish the app
44+
```
45+
dotnet publish -c Release
46+
```
47+
48+
b. Package the published app into a zip file (or use whatever zip tool you like to do it)
49+
```
50+
cd bin/Release/netcoreapp3.1/publish
51+
zip app.zip * -r
52+
```
53+
54+
c. Publish using Azure CLI
55+
```
56+
az webapp deployment source config-zip -n <app_name> -g <resource_group_name> --src app.zip
57+
```
5358
5459
1. Prepare flight data
5560
@@ -80,7 +85,6 @@ In real world scenarios you can replace the web server and the blob storage with
8085
1. Update settings of web app:
8186
8287
```
83-
az webapp config appsettings set --resource-group <resource_group_name> --name <app_name> --setting PORT=5000
8488
az webapp config appsettings set --resource-group <resource_group_name> --name <app_name> \
8589
--setting Azure__SignalR__ConnectionString=<connection_string>
8690
az webapp config appsettings set --resource-group <resource_group_name> --name <app_name> \

samples/FlightMap/Startup.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ public Startup(IConfiguration configuration)
1919
public void ConfigureServices(IServiceCollection services)
2020
{
2121
services.AddSingleton<IFlightControl, FlightControl>();
22-
services.AddMvc();
22+
services.AddControllers();
2323
services.AddSignalR().AddAzureSignalR();
2424
}
2525

2626
public void Configure(IApplicationBuilder app)
2727
{
28-
app.UseMvc();
28+
app.UseRouting();
2929
app.UseFileServer();
30-
app.UseAzureSignalR(routes =>
30+
app.UseEndpoints(endpoints =>
3131
{
32-
routes.MapHub<FlightMapSampleHub>("/flightData");
32+
endpoints.MapHub<FlightMapSampleHub>("/flightData");
3333
});
3434
}
3535
}

samples/FlightMap/wwwroot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
6868
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
6969
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.2.3/fabric.js"></script>
70+
<script src="https://cdn.jsdelivr.net/npm/@microsoft/[email protected]/dist/browser/signalr.min.js"></script>
7071
<script src="scripts/util.js"></script>
71-
<script src="scripts/signalr.js"></script>
7272
<script src='scripts/map-canvas.js'></script>
7373
<script type='text/javascript'>
7474
// global var

0 commit comments

Comments
 (0)