Skip to content

Commit

Permalink
Merge pull request #21 from dbarkol/main
Browse files Browse the repository at this point in the history
Upgrade to .NET Core 6.0
  • Loading branch information
dbarkol authored Mar 30, 2022
2 parents 9652b73 + dcc64e0 commit 426440f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 89 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: "Source code for a site that displays events from Azure Event Grid

# Azure Event Grid Viewer

This repository contains the source code for a site that displays events from Azure Event Grid in near-real time. It is built on ASP.NET Core 3.1 and leverages SignalR to display incoming messages.
This repository contains the source code for a site that displays events from Azure Event Grid in near-real time. It is built on [ASP.NET Core](https://docs.microsoft.com/aspnet/core) and leverages [SignalR](https://dotnet.microsoft.com/apps/aspnet/signalr) to display incoming messages.

For details about how it was put together, please refer to the [accompanying blog post](https://madeofstrings.com/2018/03/14/azure-event-grid-viewer-with-asp-net-core-and-signalr/).

Expand Down Expand Up @@ -42,4 +42,4 @@ For example: `https://{{site-name}}.azurewebsites.net/api/updates`
### 5. References

- [Routing events to a custom endpoint](https://docs.microsoft.com/azure/storage/blobs/storage-blob-event-quickstart?toc=%2fazure%2fevent-grid%2ftoc.json)
- [Receive events to an HTTP endpoint](https://docs.microsoft.com/en-us/azure/event-grid/receive-events)
- [Receive events to an HTTP endpoint](https://docs.microsoft.com/azure/event-grid/receive-events)
17 changes: 12 additions & 5 deletions azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"resources": [
{
"apiVersion": "2015-08-01",
"apiVersion": "2020-12-01",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('location')]",
Expand All @@ -66,7 +66,7 @@
}
},
{
"apiVersion": "2015-08-01",
"apiVersion": "2020-12-01",
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
Expand All @@ -76,13 +76,20 @@
"properties": {
"serverFarmId": "[parameters('hostingPlanName')]",
"siteConfig": {
"webSocketsEnabled": true
"webSocketsEnabled": true,
"netFrameworkVersion": "v6.0",
"metadata": [
{
"name": "CURRENT_STACK",
"value": "dotnet"
}
]
},
"httpsOnly":true
"httpsOnly": true
},
"resources": [
{
"apiVersion": "2018-11-01",
"apiVersion": "2020-12-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
Expand Down
37 changes: 23 additions & 14 deletions viewer/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using viewer.Hubs;
using Microsoft.Extensions.DependencyInjection;

namespace viewer
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorPages();
builder.Services.AddControllers();
builder.Services.AddSignalR();

var app = builder.Build();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseCookiePolicy();

app.UseEndpoints(endpoints =>
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
endpoints.MapHub<GridEventsHub>("/hubs/gridevents");
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});

app.Run();

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}
65 changes: 0 additions & 65 deletions viewer/Startup.cs

This file was deleted.

5 changes: 2 additions & 3 deletions viewer/viewer.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

</Project>

0 comments on commit 426440f

Please sign in to comment.