Merge pull request #17756 from dotnet/master
commit
6f1b516e0c
|
@ -5,8 +5,3 @@ This repository contains the conceptual ASP.NET Core documentation hosted at [do
|
|||
API documentation changes are made in the [AspNetApiDocs repository](https://github.com/dotnet/AspNetApiDocs) against the triple slash `///` comments.
|
||||
|
||||
ASP.NET 4.x documentation changes are made in the [dotnet/AspNetDocs repository](https://github.com/dotnet/AspNetDocs).
|
||||
|
||||
## Microsoft Open Source Code of Conduct
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
@ -3,7 +3,7 @@
|
|||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="typeof(MainLayout)">
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<h1>Page not found</h1>
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Learn how to set up Apache as a reverse proxy server on CentOS to r
|
|||
monikerRange: '>= aspnetcore-2.1'
|
||||
ms.author: shboyer
|
||||
ms.custom: mvc
|
||||
ms.date: 02/05/2020
|
||||
ms.date: 04/10/2020
|
||||
uid: host-and-deploy/linux-apache
|
||||
---
|
||||
# Host ASP.NET Core on Linux with Apache
|
||||
|
@ -58,7 +58,7 @@ Because requests are forwarded by reverse proxy, use the [Forwarded Headers Midd
|
|||
|
||||
Any component that depends on the scheme, such as authentication, link generation, redirects, and geolocation, must be placed after invoking the Forwarded Headers Middleware. As a general rule, Forwarded Headers Middleware should run before other middleware except diagnostics and error handling middleware. This ordering ensures that the middleware relying on forwarded headers information can consume the header values for processing.
|
||||
|
||||
Invoke the <xref:Microsoft.AspNetCore.Builder.ForwardedHeadersExtensions.UseForwardedHeaders*> method in `Startup.Configure` before calling <xref:Microsoft.AspNetCore.Builder.AuthAppBuilderExtensions.UseAuthentication*> or similar authentication scheme middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
|
||||
Invoke the <xref:Microsoft.AspNetCore.Builder.ForwardedHeadersExtensions.UseForwardedHeaders*> method at the top of `Startup.Configure` before calling other middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
|
||||
|
||||
```csharp
|
||||
// using Microsoft.AspNetCore.HttpOverrides;
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Learn how to setup Nginx as a reverse proxy on Ubuntu 16.04 to forw
|
|||
monikerRange: '>= aspnetcore-2.1'
|
||||
ms.author: riande
|
||||
ms.custom: mvc
|
||||
ms.date: 02/05/2020
|
||||
ms.date: 04/10/2020
|
||||
uid: host-and-deploy/linux-nginx
|
||||
---
|
||||
# Host ASP.NET Core on Linux with Nginx
|
||||
|
@ -79,7 +79,7 @@ Because requests are forwarded by reverse proxy, use the [Forwarded Headers Midd
|
|||
|
||||
Any component that depends on the scheme, such as authentication, link generation, redirects, and geolocation, must be placed after invoking the Forwarded Headers Middleware. As a general rule, Forwarded Headers Middleware should run before other middleware except diagnostics and error handling middleware. This ordering ensures that the middleware relying on forwarded headers information can consume the header values for processing.
|
||||
|
||||
Invoke the <xref:Microsoft.AspNetCore.Builder.ForwardedHeadersExtensions.UseForwardedHeaders*> method in `Startup.Configure` before calling <xref:Microsoft.AspNetCore.Builder.AuthAppBuilderExtensions.UseAuthentication*> or similar authentication scheme middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
|
||||
Invoke the <xref:Microsoft.AspNetCore.Builder.ForwardedHeadersExtensions.UseForwardedHeaders*> method at the top of `Startup.Configure` before calling other middleware. Configure the middleware to forward the `X-Forwarded-For` and `X-Forwarded-Proto` headers:
|
||||
|
||||
```csharp
|
||||
// using Microsoft.AspNetCore.HttpOverrides;
|
||||
|
|
|
@ -25,7 +25,7 @@ To enable runtime compilation for all environments and configuration modes:
|
|||
|
||||
1. Install the [Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation](https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation/) NuGet package.
|
||||
|
||||
1. Update the project's `Startup.ConfigureServices` method to include a call to `AddRazorRuntimeCompilation`. For example:
|
||||
1. Update the project's `Startup.ConfigureServices` method to include a call to <xref:Microsoft.Extensions.DependencyInjection.RazorRuntimeCompilationMvcBuilderExtensions.AddRazorRuntimeCompilation*>. For example:
|
||||
|
||||
```csharp
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
|
@ -55,29 +55,15 @@ To enable runtime compilation based on the environment and configuration mode:
|
|||
|
||||
1. Update the project's `Startup.ConfigureServices` method to include a call to `AddRazorRuntimeCompilation`. Conditionally execute `AddRazorRuntimeCompilation` such that it only runs in Debug mode when the `ASPNETCORE_ENVIRONMENT` variable is set to `Development`:
|
||||
|
||||
```csharp
|
||||
public IWebHostEnvironment Env { get; set; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
IMvcBuilder builder = services.AddRazorPages();
|
||||
|
||||
#if DEBUG
|
||||
if (Env.IsDevelopment())
|
||||
{
|
||||
builder.AddRazorRuntimeCompilation();
|
||||
}
|
||||
#endif
|
||||
|
||||
// code omitted for brevity
|
||||
}
|
||||
```
|
||||
[!code-csharp[](~/mvc/views/view-compilation/sample/Startup.cs?name=snippet)]
|
||||
|
||||
## Additional resources
|
||||
|
||||
* [RazorCompileOnBuild and RazorCompileOnPublish](xref:razor-pages/sdk#properties) properties.
|
||||
* <xref:razor-pages/index>
|
||||
* <xref:mvc/views/overview>
|
||||
* <xref:razor-pages/sdk>
|
||||
* See the [runtimecompilation sample on GitHub](https://github.com/aspnet/samples/tree/master/samples/aspnetcore/mvc/runtimecompilation) for a sample that shows making runtime compilation work across projects.
|
||||
|
||||
::: moniker-end
|
||||
|
||||
|
@ -104,4 +90,4 @@ Build-time compilation is supplemented by runtime compilation of Razor files. AS
|
|||
* <xref:mvc/views/overview>
|
||||
* <xref:razor-pages/sdk>
|
||||
|
||||
::: moniker-end
|
||||
::: moniker-end
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
#region snippet
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration, IWebHostEnvironment env)
|
||||
{
|
||||
Configuration = configuration;
|
||||
Env = env;
|
||||
}
|
||||
|
||||
public IWebHostEnvironment Env { get; set; }
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
IMvcBuilder builder = services.AddRazorPages();
|
||||
|
||||
#if DEBUG
|
||||
if (Env.IsDevelopment())
|
||||
{
|
||||
builder.AddRazorRuntimeCompilation();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
if (Env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapRazorPages();
|
||||
});
|
||||
}
|
||||
}
|
||||
#endregion
|
|
@ -5,7 +5,7 @@ description: Learn how to configure ASP.NET Core SignalR apps.
|
|||
monikerRange: '>= aspnetcore-2.1'
|
||||
ms.author: bradyg
|
||||
ms.custom: mvc
|
||||
ms.date: 12/10/2019
|
||||
ms.date: 04/12/2020
|
||||
no-loc: [SignalR]
|
||||
uid: signalr/configuration
|
||||
---
|
||||
|
@ -25,7 +25,7 @@ As an example, to configure the serializer to not change the casing of property
|
|||
```csharp
|
||||
services.AddSignalR()
|
||||
.AddJsonProtocol(options => {
|
||||
options.PayloadSerializerOptions.PropertyNamingPolicy = null
|
||||
options.PayloadSerializerOptions.PropertyNamingPolicy = null;
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -1085,4 +1085,4 @@ HubConnection hubConnection = HubConnectionBuilder.create("https://example.com/m
|
|||
* <xref:signalr/messagepackhubprotocol>
|
||||
* <xref:signalr/supported-platforms>
|
||||
|
||||
::: moniker-end
|
||||
::: moniker-end
|
||||
|
|
Loading…
Reference in New Issue