MicroCenter.Core
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package MicroCenter.Core --version 1.0.0
NuGet\Install-Package MicroCenter.Core -Version 1.0.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="MicroCenter.Core" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MicroCenter.Core" Version="1.0.0" />
<PackageReference Include="MicroCenter.Core" />
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 MicroCenter.Core --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MicroCenter.Core, 1.0.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 MicroCenter.Core@1.0.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=MicroCenter.Core&version=1.0.0
#tool nuget:?package=MicroCenter.Core&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MicroCenter
项目地址
注册中心安装部署
下载代码和打包
git clone https://gitee.com/luoyanb/mc;
cd mc/Micro/MicroCenter
dotnet publish ./MicroCenter.csproj -c release -r linux-x64 -o bin/Release/netcoreapp3.1/publish/ -p:PublishSingleFile=true --self-contained false
cd bin\Release\netcoreapp3.1\publish
修改配置文件 appsettings.json
{
"MicroCenter": {
"Secret": "123456", //注册中心连接秘钥
"Environment": ""//服务启动环境默认 Production
},
"Nginx": {
"Port": 80, // nginx 代理配置
"Hostname": "localhost", //服务域名
"Root": "/home/index", //静态文件跟目录
},
"WebRootPath": "/home/", //文件根目录
"urls": "http://127.0.0.1:8686", //启动地址端口
}
上传单文件和配置文件
MicroCenter appsettings.json
指令
cd /目录
chmod u+x ./MicroCenter # 授予执行权限
./MicroCenter #前台启动
./MicroCenter start #后台服务启动
./MicroCenter stop #停止服务
./MicroCenter restart #重新启动服务
./MicroCenter enable #开启开机自启动
./MicroCenter disable # 关闭开机自启动
登录
浏览器访问 http://ip:8686/
MicroCenter.Core 客户端
安装
Install-Package MicroCenter.Core -Version 1.0.0
配置
- appsettings.json 配置
{
"MicroCenter": {
"registryUrl": "http://127.0.0.1:8686", //注册中心地址
"secret": "kjmmt" //注册中心秘钥
}
}
使用
- Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services
.AddMtp() // 添加mtp微服务
.AddMicroCenter(); //使用 MicroCenter 注册中心
}
- *Service.cs 服务端对外暴露接口
public in IAdminService
{
/// <summary>
/// 分页查询
/// </summary>
/// <returns></returns>
List<Admin> GetPage(int skip, int take, out int rows);
}
[Injection, MtpService] // MtpServiceAttribute 标记为服务
public class AdminService : Mdb<Admin>, IAdminService
{
public List<Admin> GetPage(int skip, int take, out int rows) =>
Query.GetPage(skip, take, out rows);
}
- ClientService.cs 客户端调用服务
[Injection] // MtpServiceAttribute 标记为服务
public class ClientService
{
[MtpResource] //从远程服务引入接口
public readonly IAdminService adminService;
public List<Admin> GetPage(int skip, int take, out int rows) =>
adminService.GetPage(skip, take, out rows); // 调用远程服务的 GetPage 方法
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Microsoft.AspNetCore.SignalR.Client (>= 3.0.0)
- MTPCore (>= 1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.