Dela via


Prerenderer.RenderToString Method

Definition

Caution

Use Microsoft.AspNetCore.SpaServices.Extensions

Performs server-side prerendering by invoking code in Node.js.

public:
 static System::Threading::Tasks::Task<Microsoft::AspNetCore::SpaServices::Prerendering::RenderToStringResult ^> ^ RenderToString(System::String ^ applicationBasePath, Microsoft::AspNetCore::NodeServices::INodeServices ^ nodeServices, System::Threading::CancellationToken applicationStoppingToken, Microsoft::AspNetCore::SpaServices::Prerendering::JavaScriptModuleExport ^ bootModule, System::String ^ requestAbsoluteUrl, System::String ^ requestPathAndQuery, System::Object ^ customDataParameter, int timeoutMilliseconds, System::String ^ requestPathBase);
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult> RenderToString (string applicationBasePath, Microsoft.AspNetCore.NodeServices.INodeServices nodeServices, System.Threading.CancellationToken applicationStoppingToken, Microsoft.AspNetCore.SpaServices.Prerendering.JavaScriptModuleExport bootModule, string requestAbsoluteUrl, string requestPathAndQuery, object customDataParameter, int timeoutMilliseconds, string requestPathBase);
[System.Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult> RenderToString (string applicationBasePath, Microsoft.AspNetCore.NodeServices.INodeServices nodeServices, System.Threading.CancellationToken applicationStoppingToken, Microsoft.AspNetCore.SpaServices.Prerendering.JavaScriptModuleExport bootModule, string requestAbsoluteUrl, string requestPathAndQuery, object customDataParameter, int timeoutMilliseconds, string requestPathBase);
static member RenderToString : string * Microsoft.AspNetCore.NodeServices.INodeServices * System.Threading.CancellationToken * Microsoft.AspNetCore.SpaServices.Prerendering.JavaScriptModuleExport * string * string * obj * int * string -> System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult>
[<System.Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")>]
static member RenderToString : string * Microsoft.AspNetCore.NodeServices.INodeServices * System.Threading.CancellationToken * Microsoft.AspNetCore.SpaServices.Prerendering.JavaScriptModuleExport * string * string * obj * int * string -> System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult>
Public Shared Function RenderToString (applicationBasePath As String, nodeServices As INodeServices, applicationStoppingToken As CancellationToken, bootModule As JavaScriptModuleExport, requestAbsoluteUrl As String, requestPathAndQuery As String, customDataParameter As Object, timeoutMilliseconds As Integer, requestPathBase As String) As Task(Of RenderToStringResult)

Parameters

applicationBasePath
String

The root path to your application. This is used when resolving project-relative paths.

nodeServices
INodeServices

The instance of INodeServices that will be used to invoke JavaScript code.

applicationStoppingToken
CancellationToken

A token that indicates when the host application is stopping.

bootModule
JavaScriptModuleExport

The path to the JavaScript file containing the prerendering logic.

requestAbsoluteUrl
String

The URL of the currently-executing HTTP request. This is supplied to the prerendering code.

requestPathAndQuery
String

The path and query part of the URL of the currently-executing HTTP request. This is supplied to the prerendering code.

customDataParameter
Object

An optional JSON-serializable parameter to be supplied to the prerendering code.

timeoutMilliseconds
Int32

The maximum duration to wait for prerendering to complete.

requestPathBase
String

The PathBase for the currently-executing HTTP request.

Returns

Attributes

Applies to