MicroCloud.AspNetCore
8.0.3.1
dotnet add package MicroCloud.AspNetCore --version 8.0.3.1
NuGet\Install-Package MicroCloud.AspNetCore -Version 8.0.3.1
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="MicroCloud.AspNetCore" Version="8.0.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MicroCloud.AspNetCore --version 8.0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MicroCloud.AspNetCore, 8.0.3.1"
#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.
// Install MicroCloud.AspNetCore as a Cake Addin #addin nuget:?package=MicroCloud.AspNetCore&version=8.0.3.1 // Install MicroCloud.AspNetCore as a Cake Tool #tool nuget:?package=MicroCloud.AspNetCore&version=8.0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MicroCloud AspNetCore 组件
说明
MicroCloud AspNetCore 组件,提供 AspNetCore 的服务端功能的封装。
用法
可按照如下配置方式使用:
- 通过nuget引用
MicroCloud.AspNetCore
程序集
Install-Package MicroCloud.AspNetCore
- 在
appsettings.json
中 的MicroCloud
节点下添加如下配置节点
{
//Cors跨域策略
"Cors": {
"PolicyName": "MicroCloudAPI", //策略名称
"AllowAnyHeader": true, //允许任意请求头
"WithHeaders": [ "Authorization", "Accept", "Accept-Language" ], //允许的请求头,当 AllowAnyHeader = false 时生效
"AllowAnyMethod": true, //允许任意方法
"WithMethods": [ "POST", "PUT", "DELETE" ], //允许的方法,当 AllowAnyMethod = false 时生效
"AllowCredentials": true, //允许跨域凭据,优先级高于 DisallowCredentials 设置
"DisallowCredentials": false, //禁止跨域凭据
"AllowAnyOrigin": true, //允许任意来源
"WithOrigins": [ "https://localhost:44398", "http://127.0.0.1:5001" ], //允许的来源,当 AllowAnyOrigin = false 时生效
"Enabled": true //设置跨源资源共享服务是否启用
},
//Mvc选项
"Mvc": {
"DefaultLanguage": "zh_CN", //默认语言,可实现AcceptLanguage请求语言的消息字符解析,语言文件存放于“configs/localization”路径下
"IsLowercaseJsonProperty": false, //Json属性名称驼峰(lowerCase)写法设置,默认:false
"IsLowercaseUrls": false, //URL驼峰(lowerCase)写法设置,默认:false
"ReferenceLoopHandling": "Ignore", //循环引用处理:"Error"、"Ignore"、"Serialize",默认:"Ignore"
"NullValueHandling": "Include", //Null值处理:"Include"、"Ignore",默认:"Include"
"StringEnumConvert": false, //String与Enum类型转换,默认:false
"StringLongConvert": true, //String与Long类型转换,默认:true
"DateFormatHandling": "Iso", //日期时间格式化处理:"Iso"、"Microsoft",默认:"Iso"
"DateFormatString": "", //日期时间格式化字符串,例如:"yyyy/MM/dd HH:mm:ss",默认:""
"DateTimeZoneHandling": "Local", //日期时间时区处理:"Local"、"Utc"、Unspecified"、RoundtripKind",默认:"Local"
"DateParseHandling": "DateTime" //日期时间解析处理:"None"、"DateTime"、"DateTimeOffset",默认:"DateTime""
},
//宿主配置策略
"Host": {
//终结点
"Endpoints": {
"Http": {
"Address": "", //IP地址(*或者不填默认本机任意IP)
"Port": "38062", //监听端口
"Enabled": true //是否启用
},
"Https": {
"Address": "*", //IP地址(*或者不填默认本机任意IP)
"Port": "38063", //监听端口
//SSL证书(不为空时将使用HTTPS)
"Certificate": {
"Source": "File", //源(固定字符“File”)
"Path": "Certificate\\MicroCloud.pfx", //证书路径
"Password": "password" //证书密钥
},
"Enabled": true //是否启用
}
}
},
//SignalR实时通信配置
//心跳监测机制:A. 以客户端为基准的机制。客户端配置:serverTimeoutInMilliseconds + 服务端端配置:keepAliveinterval,建议 serverTimeoutInMilliseconds 的值是 keepAliveinterval 的两倍,从而保证客户端不进入 onclose 回调,不掉线。
//心跳监测机制:B. 以服务端为基准的机制。客户端配置:keepAliveIntervalInmillisecods + 服务端配置:clientTimeoutInterval,建议 clientTimeoutInterval 的值是 keepAliveIntervalInmillisecods 的两倍,从而保证不进服务器端的 OnDisconnectedAsync 回调,即不掉线。
"SignalR": {
//如果客户端在此时间间隔内未收到消息(包括保持活动状态),则服务器会将客户端视为已断开连接。默认超时为30秒。
//由于实现方式的原因,客户端实际标记为断开连接可能需要更长的时间。建议值为 KeepAliveInterval 值的两倍。
"ClientTimeoutInterval": 30,
//如果客户端在此时间间隔内未发送初始握手消息,连接将关闭。 这是一种高级设置,只应在握手超时错误由于严重网络延迟而发生时进行修改。默认超时为15秒。
//有关握手过程的详细信息,请参阅SignalR 集线器协议规范。
"HandshakeTimeout": -1,
//如果服务器未在此时间间隔内发送消息,则会自动发送 ping 消息,使连接保持打开状态。默认间隔为15秒。
//更改 KeepAliveInterval时,请更改客户端上的 ServerTimeout/serverTimeoutInMilliseconds 设置。 建议的 ServerTimeout/serverTimeoutInMilliseconds 值为 KeepAliveInterval 值的两倍。
"KeepAliveInterval": 15,
"MaximumReceiveMessageSize": 51200, //单个传入集线器消息的最大消息大小。默认值为32KB。
"StreamBufferCapacity": 1024, //客户端上载流的最大缓冲区大小。默认大小为10。
"MessagePackEnabled": true, //启用MessagePack(支持二进制内容传输)
"RoutePattern": "/signalr", //线路型式(用于挂载SignalR终结点)
"Enabled": true //是否启用
},
}
交流
QQ群号:863605868 | 微信号:SeonHu |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- MicroCloud (>= 8.0.3.1)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.8)
- Microsoft.AspNetCore.Authentication.MicrosoftAccount (>= 8.0.8)
- Microsoft.AspNetCore.Authorization (>= 8.0.8)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 8.0.8)
- Microsoft.AspNetCore.SignalR.Protocols.MessagePack (>= 8.0.8)
- Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (>= 8.0.8)
- Microsoft.AspNetCore.SignalR.StackExchangeRedis (>= 8.0.8)
NuGet packages (12)
Showing the top 5 NuGet packages that depend on MicroCloud.AspNetCore:
Package | Downloads |
---|---|
MicroCloud.Identity
MicroCloud 身份认证组件,基于 AspNetCore.Identity 和 MicroCloud数据仓储模型 的身份认证实现。 |
|
MicroCloud.SMS
MicroCloud 短信组件,封装阿里云、逸峰信盈通验证码、通知、推广短信处理功能。目前已完成验证码短信发送、验证的处理机制。 |
|
MicroCloud.Pack.Audit
MicroCloud 审计模块,包含操作审计和数据审计。 |
|
MicroCloud.Hangfire
MicroCloud Hangfire 后台任务组件,封装基于 Hangfire 后台任务的服务端实现。 |
|
MicroCloud.MiniProfiler
MicroCloud MiniProfiler 性能监测组件,封装基于 MiniProfiler 框架实现的性能监测功能。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.3.1 | 264 | 9/9/2024 |
8.0.2.9 | 272 | 9/5/2024 |
8.0.2.8 | 255 | 8/31/2024 |
8.0.2.7 | 247 | 8/31/2024 |
8.0.2.6 | 268 | 8/21/2024 |
8.0.2.5 | 268 | 8/21/2024 |
8.0.2.4 | 239 | 8/12/2024 |
8.0.2.3 | 250 | 8/8/2024 |
8.0.2.2 | 218 | 7/14/2024 |
8.0.2.1 | 230 | 6/7/2024 |
8.0.1.9 | 240 | 6/6/2024 |
8.0.1.8 | 229 | 6/6/2024 |
8.0.1.7 | 228 | 5/15/2024 |
8.0.1.6 | 196 | 5/15/2024 |
8.0.1.5 | 196 | 5/15/2024 |
8.0.1.4 | 193 | 5/14/2024 |
8.0.1.3 | 216 | 5/10/2024 |
8.0.1.2 | 247 | 5/8/2024 |
8.0.1.1 | 263 | 5/7/2024 |
8.0.0.9 | 261 | 5/1/2024 |
8.0.0.8 | 254 | 5/1/2024 |
8.0.0.7 | 273 | 4/30/2024 |
8.0.0.5 | 264 | 4/19/2024 |
8.0.0.4 | 248 | 4/18/2024 |
8.0.0.3 | 281 | 4/15/2024 |
8.0.0.2 | 274 | 4/12/2024 |
8.0.0.1 | 243 | 4/12/2024 |
7.2.0.8 | 265 | 4/12/2024 |
7.2.0.7 | 261 | 4/12/2024 |
7.2.0.6 | 253 | 4/12/2024 |
7.2.0.5 | 251 | 4/12/2024 |
7.2.0.4 | 267 | 4/11/2024 |
7.2.0.2 | 350 | 4/7/2024 |
7.2.0.1 | 533 | 10/26/2023 |
7.1.2.9 | 358 | 11/7/2023 |
7.1.2.8 | 384 | 10/19/2023 |
7.1.2.7 | 330 | 10/19/2023 |
7.1.2.6 | 391 | 10/18/2023 |
7.1.2.5 | 363 | 9/20/2023 |
7.1.2.4 | 436 | 9/13/2023 |
7.1.2.3 | 351 | 9/13/2023 |
7.1.2.2 | 375 | 9/12/2023 |
7.1.2.1 | 363 | 9/4/2023 |
7.1.1.9 | 458 | 8/31/2023 |
7.1.1.8 | 149 | 8/31/2023 |
7.1.1.6 | 391 | 8/29/2023 |
7.1.1.5 | 381 | 8/25/2023 |
7.1.1.4 | 384 | 8/25/2023 |
7.1.1.3 | 373 | 8/25/2023 |
7.1.1.2 | 336 | 8/24/2023 |
7.1.1.1 | 391 | 8/24/2023 |
7.0.3.1 | 410 | 8/24/2023 |
7.0.2.7 | 338 | 5/12/2023 |
7.0.2.6 | 492 | 5/11/2023 |
7.0.1.7 | 475 | 5/9/2023 |
7.0.1.6 | 499 | 5/9/2023 |
7.0.1.4 | 533 | 4/24/2023 |
7.0.1.3 | 529 | 4/19/2023 |
7.0.1.2 | 570 | 4/19/2023 |
7.0.1.1 | 332 | 4/19/2023 |
7.0.0.9 | 519 | 4/18/2023 |
7.0.0.8 | 524 | 4/17/2023 |
7.0.0.7 | 598 | 4/12/2023 |
7.0.0.6 | 572 | 4/8/2023 |
7.0.0.5 | 580 | 4/7/2023 |
7.0.0.4 | 638 | 4/7/2023 |
7.0.0.3 | 619 | 4/7/2023 |