Configuration options
As you might have seen in the last tutorials, the main configuration is made in the app host Configure
method.
//Set JSON web services to return idiomatic JSON camelCase properties
ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;
//Change the default ServiceStack configuration
Feature disableFeatures = Feature.Jsv | Feature.Soap;
SetConfig(new HostConfig {
EnableFeatures = Feature.All.Remove(disableFeatures), //all formats except of JSV and SOAP
DebugMode = true, //Show StackTraces in service responses during development
WriteErrorsToResponse = false, //Disable exception handling
DefaultContentType = ContentType.Json, //Change default content type
AllowJsonpRequests = true //Enable JSONP requests
});
Property name | Default value | Description |
---|---|---|
EnableFeatures | Feature.All | Defines the formats which the webservice should understand |
DebugMode | false | If true, stack traces will be shown in service responses during development |
WriteErrorsToResponse | true | |
DefaultContentType | ContentType.Json | |
AllowJsonpRequests | true | |
GlobalResponseHeaders | Sets global headers which will be added to every request response. (Example) |
Note:
DebugMode
should be set to false in production because of security reasons!
To ensure every ServiceStack service uses the same Global Logger, set it before you initialize ServiceStack's AppHost, e.g:
LogManager.LogFactory = new DebugLogFactory();
new AppHost().Init();
- 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