HttpConnectionContextExtensions.GetHttpContext(ConnectionContext) 方法

定义

HttpContext获取与连接关联的 (如果有)。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Http::HttpContext ^ GetHttpContext(Microsoft::AspNetCore::Connections::ConnectionContext ^ connection);
public static Microsoft.AspNetCore.Http.HttpContext GetHttpContext (this Microsoft.AspNetCore.Connections.ConnectionContext connection);
public static Microsoft.AspNetCore.Http.HttpContext? GetHttpContext (this Microsoft.AspNetCore.Connections.ConnectionContext connection);
static member GetHttpContext : Microsoft.AspNetCore.Connections.ConnectionContext -> Microsoft.AspNetCore.Http.HttpContext
<Extension()>
Public Function GetHttpContext (connection As ConnectionContext) As HttpContext

参数

connection
ConnectionContext

表示 ConnectionContext 连接的 。

返回

HttpContext与连接关联的 ;如果连接不基于 HTTP,null则为 。

注解

SignalR 连接可以在 HTTP 传输(如 WebSocket 或长轮询)或其他非 HTTP 传输上运行。 因此,此方法有时可能会根据应用程序的配置返回 null

适用于