commit
0908d08e9c
|
@ -114,12 +114,11 @@ In the preceding code, `SharedResource` is the class corresponding to the resx w
|
|||
|
||||
### SupportedCultures and SupportedUICultures
|
||||
|
||||
ASP.NET Core allows you to specify two culture values, `SupportedCultures` and `SupportedUICultures`. The [CultureInfo](/dotnet/api/system.globalization.cultureinfo) object for `SupportedCultures` determines the results of culture-dependent functions, such as date, time, number, and currency formatting. `SupportedCultures` also determines the sorting order of text, casing conventions, and string comparisons. See [CultureInfo.CurrentCulture](/dotnet/api/system.stringcomparer.currentculture#System_StringComparer_CurrentCulture) for more info on how the server gets the Culture. The `SupportedUICultures` determines which translates strings (from *.resx* files) are looked up by the [ResourceManager](/dotnet/api/system.resources.resourcemanager). The `ResourceManager` simply looks up culture-specific strings that's determined by `CurrentUICulture`. Every thread in .NET has
|
||||
`CurrentCulture` and `CurrentUICulture` objects. ASP.NET Core inspects these values when rendering culture-dependent functions. For example, if the current thread's culture is set to "en-US" (English, United States), `DateTime.Now.ToLongDateString()` displays "Thursday, February 18, 2016", but if `CurrentCulture` is set to "es-ES" (Spanish, Spain) the output will be "jueves, 18 de febrero de 2016".
|
||||
ASP.NET Core allows you to specify two culture values, `SupportedCultures` and `SupportedUICultures`. The [CultureInfo](/dotnet/api/system.globalization.cultureinfo) object for `SupportedCultures` determines the results of culture-dependent functions, such as date, time, number, and currency formatting. `SupportedCultures` also determines the sorting order of text, casing conventions, and string comparisons. See [CultureInfo.CurrentCulture](/dotnet/api/system.stringcomparer.currentculture#System_StringComparer_CurrentCulture) for more info on how the server gets the Culture. The `SupportedUICultures` determines which translated strings (from *.resx* files) are looked up by the [ResourceManager](/dotnet/api/system.resources.resourcemanager). The `ResourceManager` simply looks up culture-specific strings that's determined by `CurrentUICulture`. Every thread in .NET has `CurrentCulture` and `CurrentUICulture` objects. ASP.NET Core inspects these values when rendering culture-dependent functions. For example, if the current thread's culture is set to "en-US" (English, United States), `DateTime.Now.ToLongDateString()` displays "Thursday, February 18, 2016", but if `CurrentCulture` is set to "es-ES" (Spanish, Spain) the output will be "jueves, 18 de febrero de 2016".
|
||||
|
||||
## Resource files
|
||||
|
||||
A resource file is a useful mechanism for separating localizable strings from code. Translated strings for the non-default language are isolated *.resx* resource files. For example, you might want to create Spanish resource file named *Welcome.es.resx* containing translated strings. "es" is the language code for Spanish. To create this resource file in Visual Studio:
|
||||
A resource file is a useful mechanism for separating localizable strings from code. Translated strings for the non-default language are isolated in *.resx* resource files. For example, you might want to create Spanish resource file named *Welcome.es.resx* containing translated strings. "es" is the language code for Spanish. To create this resource file in Visual Studio:
|
||||
|
||||
1. In **Solution Explorer**, right click on the folder which will contain the resource file > **Add** > **New Item**.
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -257,7 +257,8 @@ ENTRYPOINT ["dotnet", "aspnetapp.dll"]
|
|||
* [ASP.NET Core Docker sample](https://github.com/dotnet/dotnet-docker) (The one used in this tutorial.)
|
||||
* [Configure ASP.NET Core to work with proxy servers and load balancers](/aspnet/core/host-and-deploy/proxy-load-balancer)
|
||||
* [Working with Visual Studio Docker Tools](https://docs.microsoft.com/aspnet/core/publishing/visual-studio-tools-for-docker)
|
||||
* [Debugging with Visual Studio Code](https://code.visualstudio.com/docs/nodejs/debugging-recipes#_debug-nodejs-in-docker-containers)
|
||||
* [Debugging with Visual Studio Code](https://code.visualstudio.com/docs/nodejs/debugging-recipes#_debug-nodejs-in-docker-containers)
|
||||
* [GC using Docker and small containers](xref:performance/memory#sc)
|
||||
|
||||
## Next steps
|
||||
|
||||
|
|
|
@ -34,3 +34,6 @@ Find out how to use the Visual Studio Container Tools extension to deploy an ASP
|
|||
|
||||
[Configure ASP.NET Core to work with proxy servers and load balancers](xref:host-and-deploy/proxy-load-balancer)
|
||||
Additional configuration might be required for apps hosted behind proxy servers and load balancers. Passing requests through a proxy often obscures information about the original request, such as the scheme and client IP. It might be necessary to forwarded some information about the request manually to the app.
|
||||
|
||||
[GC using Docker and small containers](xref:performance/memory#sc)
|
||||
Discusses GC selection with small containers.
|
|
@ -232,3 +232,4 @@ There may be an expectation for the production or release image to be smaller in
|
|||
* [Deploy a .NET app in a Windows container to Azure Service Fabric](/azure/service-fabric/service-fabric-host-app-in-a-container)
|
||||
* [Troubleshoot Visual Studio development with Docker](/azure/vs-azure-tools-docker-troubleshooting-docker-errors)
|
||||
* [Visual Studio Container Tools GitHub repository](https://github.com/Microsoft/DockerTools)
|
||||
* [GC using Docker and small containers](xref:performance/memory#sc)
|
||||
|
|
|
@ -4,7 +4,7 @@ author: guardrex
|
|||
ms.author: riande
|
||||
description: Learn how to use the ASP.NET Core Component Tag Helper to render Razor components in pages and views.
|
||||
ms.custom: mvc
|
||||
ms.date: 04/01/2020
|
||||
ms.date: 04/15/2020
|
||||
no-loc: [Blazor, SignalR]
|
||||
uid: mvc/views/tag-helpers/builtin-th/component-tag-helper
|
||||
---
|
||||
|
@ -16,7 +16,7 @@ To render a component from a page or view, use the [Component Tag Helper](xref:M
|
|||
|
||||
## Prerequisites
|
||||
|
||||
Follow the guidance in the *Prepare the app to use components in pages and views* section of the <xref:blazor/integrate-components#prepare-the-app-to-use-components-in-pages-and-views> article.
|
||||
Follow the guidance in the *Prepare the app to use components in pages and views* section of the <xref:blazor/integrate-components#prepare-the-app> article.
|
||||
|
||||
## Component Tag Helper
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ author: rick-anderson
|
|||
description: Learn how memory is managed in ASP.NET Core and how the garbage collector (GC) works.
|
||||
ms.author: riande
|
||||
ms.custom: mvc
|
||||
ms.date: 12/05/2019
|
||||
ms.date: 4/05/2019
|
||||
uid: performance/memory
|
||||
---
|
||||
|
||||
|
@ -148,6 +148,12 @@ The differences between this chart and the server version are significant:
|
|||
|
||||
On a typical web server environment, CPU usage is more important than memory, therefore the Server GC is better. If memory utilization is high and CPU usage is relatively low, the Workstation GC might be more performant. For example, high density hosting several web apps where memory is scarce.
|
||||
|
||||
<a name="sc"></a>
|
||||
|
||||
### GC using Docker and small containers
|
||||
|
||||
When multiple containerized apps are running on one machine, Workstation GC might be more preformant than Server GC. For more information, see [Running with Server GC in a Small Container](https://devblogs.microsoft.com/dotnet/running-with-server-gc-in-a-small-container-scenario-part-0/) and [Running with Server GC in a Small Container Scenario Part 1 – Hard Limit for the GC Heap](https://devblogs.microsoft.com/dotnet/running-with-server-gc-in-a-small-container-scenario-part-1-hard-limit-for-the-gc-heap/).
|
||||
|
||||
### Persistent object references
|
||||
|
||||
The GC cannot free objects that are referenced. Objects that are referenced but no longer needed result in a memory leak. If the app frequently allocates objects and fails to free them after they are no longer needed, memory usage will increase over time.
|
||||
|
|
|
@ -178,4 +178,4 @@ To use custom policies from an `IAuthorizationPolicyProvider`, you must:
|
|||
services.AddSingleton<IAuthorizationPolicyProvider, MinimumAgePolicyProvider>();
|
||||
```
|
||||
|
||||
A complete custom `IAuthorizationPolicyProvider` sample is available in the [aspnet/AuthSamples GitHub repository](https://github.com/dotnet/AspNetCore/tree/release/2.2/src/Security/samples/CustomPolicyProvider).
|
||||
A complete custom `IAuthorizationPolicyProvider` sample is available in the [dotnet/aspnetcore GitHub repository](https://github.com/dotnet/aspnetcore/tree/ea555458dc61e04314598c25b3ab8c56362a5123/src/Security/samples/CustomPolicyProvider).
|
||||
|
|
|
@ -103,7 +103,7 @@ Enabling CORS on a per-endpoint basis using `RequireCors` currently does ***not*
|
|||
|
||||
With endpoint routing, CORS can be enabled on a per-endpoint basis using the <xref:Microsoft.AspNetCore.Builder.CorsEndpointConventionBuilderExtensions.RequireCors*> set of extension methods:
|
||||
|
||||
[!code-csharp[](cors/3.1sample/Cors/WebAPI/StartupEndPt.cs?name=snippet2&highlight=3,7-15,32,41,44)]
|
||||
[!code-csharp[](cors/3.1sample/Cors/WebAPI/StartupEndPt.cs?name=snippet2&highlight=3,7-15,32,40,43)]
|
||||
|
||||
In the preceding code:
|
||||
|
||||
|
|
|
@ -138,9 +138,9 @@ SignalR determines which client method to call by matching the method name and a
|
|||
|
||||
Chain a `catch` method to the end of the `start` method to handle client-side errors. Use `console.error` to output errors to the browser's console.
|
||||
|
||||
[!code-javascript[Error handling](javascript-client/sample/wwwroot/js/chat.js?range=49-51)]
|
||||
[!code-javascript[Error handling](javascript-client/sample/wwwroot/js/chat.js?range=50)]
|
||||
|
||||
Setup client-side log tracing by passing a logger and type of event to log when the connection is made. Messages are logged with the specified log level and higher. Available log levels are as follows:
|
||||
Set up client-side log tracing by passing a logger and type of event to log when the connection is made. Messages are logged with the specified log level and higher. Available log levels are as follows:
|
||||
|
||||
* `signalR.LogLevel.Error` – Error messages. Logs `Error` messages only.
|
||||
* `signalR.LogLevel.Warning` – Warning messages about potential errors. Logs `Warning`, and `Error` messages.
|
||||
|
@ -171,7 +171,7 @@ Without any parameters, `withAutomaticReconnect()` configures the client to wait
|
|||
Before starting any reconnect attempts, the `HubConnection` will transition to the `HubConnectionState.Reconnecting` state and fire its `onreconnecting` callbacks instead of transitioning to the `Disconnected` state and triggering its `onclose` callbacks like a `HubConnection` without automatic reconnect configured. This provides an opportunity to warn users that the connection has been lost and to disable UI elements.
|
||||
|
||||
```javascript
|
||||
connection.onreconnecting((error) => {
|
||||
connection.onreconnecting(error => {
|
||||
console.assert(connection.state === signalR.HubConnectionState.Reconnecting);
|
||||
|
||||
document.getElementById("messageInput").disabled = true;
|
||||
|
@ -190,7 +190,7 @@ Since the connection looks entirely new to the server, a new `connectionId` will
|
|||
> The `onreconnected` callback's `connectionId` parameter will be undefined if the `HubConnection` was configured to [skip negotiation](xref:signalr/configuration#configure-client-options).
|
||||
|
||||
```javascript
|
||||
connection.onreconnected((connectionId) => {
|
||||
connection.onreconnected(connectionId => {
|
||||
console.assert(connection.state === signalR.HubConnectionState.Connected);
|
||||
|
||||
document.getElementById("messageInput").disabled = false;
|
||||
|
@ -220,7 +220,7 @@ async function start() {
|
|||
If the client doesn't successfully reconnect within its first four attempts, the `HubConnection` will transition to the `Disconnected` state and fire its [onclose](/javascript/api/%40aspnet/signalr/hubconnection#onclose) callbacks. This provides an opportunity to inform users the connection has been permanently lost and recommend refreshing the page:
|
||||
|
||||
```javascript
|
||||
connection.onclose((error) => {
|
||||
connection.onclose(error => {
|
||||
console.assert(connection.state === signalR.HubConnectionState.Disconnected);
|
||||
|
||||
document.getElementById("messageInput").disabled = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// such as Internet Explorer 11, use a transpiler such as
|
||||
// Babel at http://babeljs.io/.
|
||||
//
|
||||
// See Es5-chat.js for a Babel transpiled version of the following code:
|
||||
// See Es5-chat.js for a Babel-transpiled version of the following code:
|
||||
|
||||
const connection = new signalR.HubConnectionBuilder()
|
||||
.withUrl("/chatHub")
|
||||
|
@ -12,7 +12,7 @@ const connection = new signalR.HubConnectionBuilder()
|
|||
.build();
|
||||
|
||||
connection.on("ReceiveMessage", (user, message) => {
|
||||
const encodedMsg = user + " says " + message;
|
||||
const encodedMsg = `${user} says ${message}`;
|
||||
const li = document.createElement("li");
|
||||
li.textContent = encodedMsg;
|
||||
document.getElementById("messagesList").appendChild(li);
|
||||
|
@ -21,7 +21,7 @@ connection.on("ReceiveMessage", (user, message) => {
|
|||
document.getElementById("sendButton").addEventListener("click", event => {
|
||||
const user = document.getElementById("userInput").value;
|
||||
const message = document.getElementById("messageInput").value;
|
||||
connection.invoke("SendMessage", user, message).catch(err => console.error(err.toString()));
|
||||
connection.invoke("SendMessage", user, message).catch(err => console.error(err));
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
|
@ -43,13 +43,9 @@ connection.onclose(async () => {
|
|||
start();
|
||||
|
||||
/* this is here to show an alternative to start, with a then
|
||||
connection.start().then(function () {
|
||||
console.log("connected");
|
||||
});
|
||||
connection.start().then(() => console.log("connected"));
|
||||
*/
|
||||
|
||||
/* this is here to show another alternative to start, with a catch
|
||||
connection.start().catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
});
|
||||
connection.start().catch(err => console.error(err));
|
||||
*/
|
||||
|
|
|
@ -19,5 +19,5 @@ document.getElementById("sendButton").addEventListener("click", function (event)
|
|||
});
|
||||
|
||||
connection.start().catch(function (err) {
|
||||
return console.error(err.toString());
|
||||
return console.error(err);
|
||||
});
|
Loading…
Reference in New Issue