Order of Operations
This page has moved to docs.servicestack.net/order-of-operations
This list shows the order in which any user-defined custom hooks are executed:
-
HostContext.RawHttpHandlers
are executed before anything else, i.e. returning any ASP.NETIHttpHandler
by-passes ServiceStack completely and processes your customIHttpHandler
instead. - If the Request doesn't match any existing Routes it will search
IAppHost.CatchAllHandlers
for a match - The
IAppHost.PreRequestFilters
gets executed before the Request DTO is deserialized - Default Request DTO Binding or Custom Request Binding (if registered)
- Any Request Converters are executed
- Request Filter Attributes with Priority < 0 gets executed
- Then any Global Request Filters get executed
- Followed by Request Filter Attributes with Priority >= 0
- Action Request Filters
- Then your Service is executed with the configured IServiceRunner and its OnBeforeExecute, OnAfterExecute and HandleException custom hooks are fired
- Action Response Filters
- Any Response Converters are executed
- Followed by Response Filter Attributes with Priority < 0
- Then Global Response Filters
- Followed by Response Filter Attributes with Priority >= 0
- Finally at the end of the Request
IAppHost.OnEndRequest
and anyIAppHost.OnEndRequestCallbacks
are fired
Any time you close the Response in any of your filters, i.e. httpRes.EndRequest()
the processing of the response is short-circuited and no further processing is done on that request.
- Any Global Request Filters get executed
- Followed by Request Filter Attributes with Priority >= 0
- Action Request Filters
- Then your Service is executed with the configured IServiceRunner and its OnBeforeExecute, OnAfterExecute and HandleException custom hooks are fired
- Action Response Filters
- Then Global Response Filters
- Finally at the end of the Request
IAppHost.OnEndRequest
is fired
The Implementation architecture diagram shows a visual cue of the internal order of operations that happens in ServiceStack:
After the IHttpHandler is returned, it gets executed with the current ASP.NET or HttpListener request wrapped in a common IHttpRequest instance.
The implementation of RestHandler shows what happens during a typical ServiceStack request:
- Why ServiceStack?
- Important role of DTOs
- What is a message based web service?
- Advantages of message based web services
- Why remote services should use separate DTOs
-
Getting Started
-
Designing APIs
-
Reference
-
Clients
-
Formats
-
View Engines 4. Razor & Markdown Razor
-
Hosts
-
Security
-
Advanced
- Configuration options
- Access HTTP specific features in services
- Logging
- Serialization/deserialization
- Request/response filters
- Filter attributes
- Concurrency Model
- Built-in profiling
- Form Hijacking Prevention
- Auto-Mapping
- HTTP Utils
- Dump Utils
- Virtual File System
- Config API
- Physical Project Structure
- Modularizing Services
- MVC Integration
- ServiceStack Integration
- Embedded Native Desktop Apps
- Auto Batched Requests
- Versioning
- Multitenancy
-
Caching
-
HTTP Caching 1. CacheResponse Attribute 2. Cache Aware Clients
-
Auto Query
-
AutoQuery Data 1. AutoQuery Memory 2. AutoQuery Service 3. AutoQuery DynamoDB
-
Server Events
-
Service Gateway
-
Encrypted Messaging
-
Plugins
-
Tests
-
ServiceStackVS
-
Other Languages
-
Amazon Web Services
-
Deployment
-
Install 3rd Party Products
-
Use Cases
-
Performance
-
Other Products
-
Future