add live reloading to authorization server

This commit is contained in:
Muhammad Azeez 2021-01-18 11:46:51 +03:00
parent 3735ef928c
commit 3f867ce97f
4 changed files with 21 additions and 8 deletions

View File

@ -1,15 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IdentityServer4" Version="4.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="TwoStepsAuthenticator" Version="1.4.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.1" />
<PackageReference Include="Westwind.AspNetCore.LiveReload" Version="0.3.1" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties properties_4launchsettings_1json__JsonSchema="https://json.schemastore.org/local.settings" /></VisualStudio></ProjectExtensions>

View File

@ -4,7 +4,8 @@
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
},
"applicationUrl": "http://localhost:10000"
}

View File

@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Net;
using Westwind.AspNetCore.LiveReload;
namespace OidcSamples.AuthorizationServer
{
@ -24,8 +25,13 @@ namespace OidcSamples.AuthorizationServer
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddControllersWithViews().AddRazorRuntimeCompilation();
services.AddLiveReload(config =>
{
// optional - use config instead
//config.LiveReloadEnabled = true;
//config.FolderToMonitor = Path.GetFullname(Path.Combine(Env.ContentRootPath,"..")) ;
});
// Dirty Hack: Disable verifying SSL certificates 😬
ServicePointManager.ServerCertificateValidationCallback +=
@ -57,6 +63,9 @@ namespace OidcSamples.AuthorizationServer
public void Configure(IApplicationBuilder app)
{
// IMPORTANT: Before **any other output generating middleware** handlers including error handlers
app.UseLiveReload();
if (Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();

View File

@ -7,7 +7,7 @@
<div class="welcome-page">
<h1>
<img src="~/icon.jpg">
Welcome to IdentityServer4
Welcome IdentityServer4
<small class="text-muted">(version @version)</small>
</h1>