What is Silky?
Silky is an open-source microservice development framework built on the .NET platform, focused on two core capabilities: RPC communication and microservice governance. It follows the mainstream .NET programming model and, with minimal intrusion, transforms a plain .NET host application into a microservice with service registration, discovery, remote invocation, and distributed transaction support.
Silky's core philosophy:
Interface as Service — A plain C# interface annotated with
[ServiceRoute]becomes a complete microservice endpoint. The framework automatically generates both an HTTP WebAPI and an RPC endpoint — no manual routing, no extra configuration.

Core Architecture
┌──────────────────────────────────────────────────────────┐
│ HTTP / WebSocket Clients │
└─────────────────────────┬────────────────────────────────┘
│ HTTPS
┌─────────────▼─────────────┐
│ Silky API Gateway │
│ Swagger · JWT · RateLimit │
│ CORS · Auditing · Profiler│
└─────────────┬─────────────┘
│ DotNetty TCP RPC
┌──────────────────┼──────────────────┐
│ │ │
┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐
│ Service A │ ←──► │ Service B │ ←──►│ Service C │
│ (Host) │ RPC │ (Host) │ RPC│ (Host) │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
└──────────────────┼──────────────────┘
│
┌────────────────┼────────────────┐
┌─────▼──────┐ ┌──────▼─────┐ ┌──────▼──────┐
│ Consul / │ │ Redis / │ │ MySQL / PG │
│ Nacos / │ │ Dist. Cache│ │ SQL Server │
│ Zookeeper │ │ │ │ (EF Core) │
└────────────┘ └────────────┘ └─────────────┘
The overall architecture consists of the following layers:
1. Service Engine & Modular System
Silky is built on a modular design where each functional unit is encapsulated as an independent SilkyModule. Dependencies are declared via the [DependsOn] attribute, and the framework completes service registration and initialization in dependency order at startup.
- Developers don't need to manage complex service registration order
- Framework capabilities can be extended via custom modules or dynamically loaded plugins
Initialize/Shutdownlifecycle hooks allow custom logic (e.g., database migrations)
2. RPC Communication Layer
Silky uses DotNetty as the underlying transport and implements high-performance RPC over persistent TCP connections:
- Interface Proxy: Autofac dynamic proxy — inject an interface and transparently call remote services
- Multiple Codecs: JSON (default), MessagePack, ProtoBuf
- Heartbeat Detection: Long connections include heartbeat to auto-detect and remove unhealthy instances
- RPC Security: Internal RPC channel protected by
rpc.token— external callers cannot bypass the gateway
3. Microservice Governance Layer
| Capability | Description |
|---|---|
| Service Registration & Discovery | Supports Zookeeper / Nacos / Consul; real-time online/offline awareness via pub-sub or heartbeat polling |
| Load Balancing | Polling, Random, HashAlgorithm — configurable per interface method |
| Timeout Control | Global or method-level RPC timeout; set to 0 for unlimited (dev environment) |
| Failover | Automatic retry on IO or communication errors; configurable retry count and interval |
| Circuit Breaking | N consecutive non-business exceptions trigger the breaker; powered by Polly |
| RPC Rate Limiting | Per-instance max concurrent request count; excess traffic is routed to other instances |
| HTTP Rate Limiting | Integrates AspNetCoreRateLimit; per-IP or per-client-ID |
| Service Fallback | [Fallback] attribute specifies a fallback interface; executed automatically on RPC failure |
| Cache Interception | Read from Redis cache on RPC call; returns cached data without network request on cache hit |
4. Host Types
Silky provides four host types to meet different deployment scenarios:
| Host Type | Builder Method | Exposes HTTP | RPC Service | WebSocket |
|---|---|---|---|---|
| General Host | ConfigureSilkyGeneralHostDefaults | ❌ | ✅ | ❌ |
| Web Host | ConfigureSilkyWebHostDefaults | ✅ | ✅ | ❌ |
| WebSocket Host | ConfigureSilkyWebSocketDefaults | ❌ | ✅ | ✅ |
| Gateway Host | ConfigureSilkyGatewayDefaults | ✅ | ❌ | ❌ |
5. Security
- Centralized Gateway Authentication: JWT Token validation at the gateway; no repeated auth logic in individual services
- RPC Token Protection: All cluster services share one
rpc.token; external callers cannot access RPC ports directly - Interface-Level Access Control:
[Authorize]/[AllowAnonymous]/[Governance(ProhibitExtranet = true)]for fine-grained control - SSL Support: RPC communication supports SSL/TLS encryption
6. Observability
- Distributed Tracing: Integrates SkyAPM — traces HTTP requests, RPC calls, TCC distributed transactions, and EFCore queries end-to-end
- Logging: Built-in Serilog support with structured logging to console, file, Elasticsearch, etc.
- Dashboard: Built-in cluster management console — visualize all service instance statuses, service entry configurations, and real-time performance metrics
Ecosystem Integration
Silky is fully compatible with the ASP.NET Core ecosystem:
| Category | Supported Components |
|---|---|
| ORM / Data Access | Entity Framework Core, FreeSql, Dapper |
| Message Bus | MassTransit, CAP (RabbitMQ, Kafka, etc.) |
| Object Mapping | AutoMapper (Silky.ObjectMapper.AutoMapper), Mapster (Silky.ObjectMapper.Mapster) |
| Validation | DataAnnotations (built-in), FluentValidation (Silky.Validation.Fluent) |
| Caching | In-memory (default), Redis (Silky.Caching.StackExchangeRedis) |
| Registry | Zookeeper (Silky.RegistryCenter.Zookeeper), Nacos (Silky.RegistryCenter.Nacos), Consul (Silky.RegistryCenter.Consul) |
| Tracing | SkyAPM (Silky.SkyApm.Agent) |
| Logging | Serilog (Silky.Logging.Serilog) |
| Distributed Lock | DistributedLock.Redis (Silky.DistributedLock.Redis) |
Supported .NET Versions
| Silky Version | Supported .NET Versions |
|---|---|
| 3.x (current stable) | .NET 6 / .NET 7 / .NET 8 / .NET 9 / .NET 10 |
Comparison with Other Frameworks
| Feature | Silky | Dapr | MassTransit | gRPC |
|---|---|---|---|---|
| Language | C# / .NET | Multi-language | C# / .NET | Multi-language |
| RPC Style | Interface proxy (transparent) | HTTP / gRPC Sidecar | Message bus | Code gen (Protobuf) |
| Service Governance | Built-in | Built-in (Sidecar) | Partial | DIY |
| Distributed Transactions | TCC (built-in) | Saga (Sidecar) | Saga (Outbox) | Not supported |
| Learning Curve | Low (.NET native model) | Medium (Sidecar architecture) | Medium | Medium |
| Deployment Complexity | Low | High (requires Dapr Runtime) | Low | Low |
Silky's advantage: extremely friendly to .NET developers — no new programming paradigm to learn. Use existing interface, DI, and middleware knowledge to build full-featured microservices without a Sidecar process.
Source Code
Contributing
- Discuss in Issues — report bugs or request features
- Submit Pull Requests to contribute code
- Join the QQ group (934306776) for community discussion
