LC6464.ASPNET.Http304
                              
                            
                                1.1.0
                            
                        
                            
                                
                                
                                    Prefix Reserved
                                
                            
                    dotnet add package LC6464.ASPNET.Http304 --version 1.1.0
NuGet\Install-Package LC6464.ASPNET.Http304 -Version 1.1.0
        
        
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
                    
    
    <PackageReference Include="LC6464.ASPNET.Http304" Version="1.1.0" />
        
        
For projects that support PackageReference, copy this XML node into the project file to reference the package.
                    
    
    <PackageVersion Include="LC6464.ASPNET.Http304" Version="1.1.0" />
<PackageReference Include="LC6464.ASPNET.Http304" />
        
        
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
                    
    
    paket add LC6464.ASPNET.Http304 --version 1.1.0
        
        
 The NuGet Team does not provide support for this client. Please contact its maintainers for support.
                    
    
    #r "nuget: LC6464.ASPNET.Http304, 1.1.0"
        
        
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
                    
    
    #:package LC6464.ASPNET.Http304@1.1.0
        
        
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
                    
    
    #addin nuget:?package=LC6464.ASPNET.Http304&version=1.1.0
#tool nuget:?package=LC6464.ASPNET.Http304&version=1.1.0
        
        
 The NuGet Team does not provide support for this client. Please contact its maintainers for support.
                    
    
    LC6464.ASPNET.Http304
在 ASP.NET 中快速设置 HTTP 304 状态码。
使用方法
ExampleWebAPI.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
	<PropertyGroup>
		<TargetFramework>net7.0</TargetFramework>
		<Nullable>enable</Nullable>
		<ImplicitUsings>enable</ImplicitUsings>
		
	</PropertyGroup>
	<ItemGroup>
		<PackageReference Include="LC6464.ASPNET.Http304" Version="1.1.0" />
		
	</ItemGroup>
	<ItemGroup>
		<Using Include="LC6464.ASPNET.Http304" />
		
	</ItemGroup>
</Project>
Program.cs:
var builder = WebApplication.CreateBuilder(args); // 创建 builder
// -------- 添加一些服务 --------
builder.Services.AddHttp304(); // 添加 Http304 服务
// -------- 添加另外一些服务、构建 WebApplication 等 --------
ExampleController.cs:
// -------- 一些 Using --------
namespace ExampleWebAPI.Controllers;
[ApiController]
[Route("[controller]")]
public class ExampleController : ControllerBase {
	private readonly ILogger<GetIPController> _logger;
	private readonly IHttp304 _http304; // 接口
	private readonly IHttpConnectionInfo _info;
	public GetIPController(ILogger<GetIPController> logger, IHttpConnectionInfo info, IHttp304 http304) { // 依赖注入
		_logger = logger;
		_info = info;
		_http304 = http304; // 赋值
	}
	[HttpGet]
	[ResponseCache(CacheProfileName = "Private1m")]
	public IP? Get() {
		var address = _info.RemoteAddress;
		_logger.LogDebug("GetIP: Client {}:{} on {}", address?.AddressFamily == AddressFamily.InterNetworkV6 ? $"[{address}]" : address, _info.RemotePort, _info.Protocol);
		
		if (_http304.TrySet(true, _info.Protocol)) return null; // 设置 304 响应
		return new(_info);
	}
}
                                | Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. | 
        
        Compatible target framework(s)
    
    
        
        Included target framework(s) (in package)
    
    Learn more about Target Frameworks and .NET Standard.
- 
                                                    
net7.0
- LC6464.ASPNET.HttpConnectionInfo (>= 1.2.0)
 
 
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
更新 .NET 版本。