Rpc服务托管程序

Warr 18ee1ff5da Upgrade 3 жил өмнө
InProcessService 6b938437fd Initial commit 3 жил өмнө
Loader 9142910e2e upgrade 3 жил өмнө
NetService 6b938437fd Initial commit 3 жил өмнө
Properties 20d2e44b93 Upgrade reference 3 жил өмнө
Tools 6b938437fd Initial commit 3 жил өмнө
.gitignore d99779116c Initial commit 3 жил өмнө
Config.s3db 20d2e44b93 Upgrade reference 3 жил өмнө
GoStaticSev.exe 20d2e44b93 Upgrade reference 3 жил өмнө
GoStaticSev_linux 6b938437fd Initial commit 3 жил өмнө
GoStaticSev_mac 6b938437fd Initial commit 3 жил өмнө
Program.cs cdf8709c3e adjustment scheme 3 жил өмнө
README.md 18ee1ff5da Upgrade 3 жил өмнө
ServerReboot.exe 6b938437fd Initial commit 3 жил өмнө
Sms.Tool 20d2e44b93 Upgrade reference 3 жил өмнө
Sms.Tool.exe cdbc5577b8 Sms tool 3 жил өмнө
WinCopy.bat cdbc5577b8 Sms tool 3 жил өмнө
WingCloudServer.csproj 18ee1ff5da Upgrade 3 жил өмнө
appsettings.json 6b938437fd Initial commit 3 жил өмнө
dockerfile 20d2e44b93 Upgrade reference 3 жил өмнө

README.md

Wing

Wing is an JsonRPC service framework

Features

  • Based on the JSONRPclite project.

Structure

The project structure is shown below

AppWorkerCenter

Service publishing and registry

AppFramework

The service framework is used for registration and is run by the AppWorkerCenter invocation

Usage

1.Create a rpc class library

image image image

2.Create a file directory

image

3.Introducing a dependency library

image

4.Define interfaces and parameters
using AppFramework.JsonRpc.Driver;
using System.Threading.Tasks;
using TestRpc.Entity;

namespace TestRpc.Service
{
    public interface INewService
    {
        Task<int> Add(AddRequest request);
    }
}

using AppFramework.JsonRpc.Driver.Validator;
using System.Text.Json.Serialization;

namespace TestRpc.Entity
{
    public class AddRequest
    {
        public string A { get; set; }

        public string B { get; set; }
    }
}
5.Implementing an interface
using AppFramework.JsonRpc.Driver;
using System.Threading.Tasks;
using TestRpc.Entity;

namespace TestRpc.Service
{
    public class NewService : BaseRpcService, INewService
    {
        public async Task<int> Add(AddRequest request)
        {
            var result = int.Parse(request.A)+int.Parse(request.B);
            return await Task.FromResult(result);
        }
    }
}
6.Implementing an Loader
using AppFramework.Common.Loader;
using System;
using TestRpc.Service;

namespace TestRpc.ServiceLoader
{
    public class NewServiceLoader : IServiceLoader
    {
        public object CreateService()
        {
            return new NewService();
        }

        public Type GetServiceType()
        {
            return typeof(INewService);
        }
    }
}
Start server
cd AppWorkerCenter/WingCloudServer
dotnet build
copy ../TestRpc.dll AppWorkerCenter/WingCloudServer/bin/Debug/net5.0/NetService/TestRpc.dll
dotnet run
For clinet test (postman)

image

ServerReboot

Automatic service restart

Sms.Tool

SMS sending program

GoStaticSev

Static file server

EmailTemplate

Email template