mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-13 17:22:54 -05:00
Update to .NET Core 3.0
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
FROM microsoft/dotnet:2.2-aspnetcore-runtime-stretch-slim AS base
|
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0.0-preview7-buster-slim AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
FROM microsoft/dotnet:2.2-sdk-stretch AS build
|
FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview7-buster AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["./Service.csproj", "./"]
|
COPY ["./Service.csproj", "./"]
|
||||||
RUN dotnet restore "Service.csproj"
|
RUN dotnet restore "Service.csproj"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
|
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||||
<AssemblyName>ChrisKaczor.HomeMonitor.Hub.Service</AssemblyName>
|
<AssemblyName>ChrisKaczor.HomeMonitor.Hub.Service</AssemblyName>
|
||||||
<RootNamespace>ChrisKaczor.HomeMonitor.Hub.Service</RootNamespace>
|
<RootNamespace>ChrisKaczor.HomeMonitor.Hub.Service</RootNamespace>
|
||||||
@@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ChrisKaczor.HomeMonitor.Weather.Models" Version="1.0.9" />
|
<PackageReference Include="ChrisKaczor.HomeMonitor.Weather.Models" Version="1.0.9" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Builder;
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
|
||||||
namespace ChrisKaczor.HomeMonitor.Hub.Service
|
namespace ChrisKaczor.HomeMonitor.Hub.Service
|
||||||
{
|
{
|
||||||
@@ -10,21 +11,25 @@ namespace ChrisKaczor.HomeMonitor.Hub.Service
|
|||||||
{
|
{
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
|
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
|
||||||
|
|
||||||
services.AddSignalR().AddJsonProtocol(options => { options.PayloadSerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver(); });
|
services.AddSignalR().AddJsonProtocol(options =>
|
||||||
|
{
|
||||||
|
options.WriteIndented = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder applicationBuilder, IHostingEnvironment environment)
|
public void Configure(IApplicationBuilder applicationBuilder, IWebHostEnvironment environment)
|
||||||
{
|
{
|
||||||
if (environment.IsDevelopment())
|
if (environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
applicationBuilder.UseDeveloperExceptionPage();
|
applicationBuilder.UseDeveloperExceptionPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationBuilder.UseSignalR(routes => { routes.MapHub<WeatherHub>("/weatherHub"); });
|
applicationBuilder.UseEndpoints(endpoints =>
|
||||||
|
{
|
||||||
applicationBuilder.UseMvc();
|
endpoints.MapHub<WeatherHub>("/weatherHub");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user