Skip to content
mythz edited this page Mar 16, 2011 · 79 revisions

#ServiceStack v2.07 - Finding Web.Config Nirvana :)

Q/A Release

This release was focused on getting ServiceStack working consistently everywhere across all ASP.NET hosts and HttpListener hosts and .NET platforms. A primary goal of ServiceStack is for your web services to be able to run everywhere in every ASP.NET or HttpListener host on Windows with .NET or on OSX/Linux with MONO.

Since your services are POCO message-based and only need to be implement an IService<TRequest> interface your services effectively operate in a clean-room DDD Service, and have a potential for re-use in a variety of other hosts, i.e. Message Queues, Windows services, Windows applications, etc.

Running cross-platform

Although the promise of the .NET architecture allows for pure C# applications to run on every .NET platform, the ASP.NET hosts don't always share the same compatibility levels as there are subtle differences in implementation and behaviour amongst the various ASP.NET hosts.

The only real way of ensuring ServiceStack runs well in each environment is to actually setup an environment on each host with each configuration we want to support. Unfortunately this time-consuming process is a necessary one in order to limit any new regressions from being introduced as a result of added features.

New ServiceStack Starter Templates projects released

So with that in mind, included in this release is the 'StartTemplates' solution providing the same Hello World Web service hosted in every supported mode and configurations. There are now 2 supported modes in which to run ServiceStack:

a) Do not require an existing Web Framework - Host from the root path: /
b) Use ServiceStack with an existing Web Framework - Host web services at a user-defined: /custompath

Starter Template projects

The new StarterTemplates in the ServiceStack.Examples GitHub project provide a good starting template for each supported configuration below:

We're happy to report the above configurations are well supported on Windows with .NET visible by the Latest Windows Integration Test Reports showing ServiceStack running correctly on IIS 3.5,4.0/WebDev Server 2.0,4.0/Windows Service/Console Application hosts.

To deploy on MONO you can just XCOPY/SFTP the files across as-is (i.e. as compiled with VS.NET) to your Linux or OSX server. In most of the scenarios it works as-is however the integration tests have uncovered a couple of known issues visible in the Latest Linux Integration Test Reports.

Known issues on MONO:

  • Depending on your setup a url with a trailing path '/' will cause Nginx/FastCGI or Apache/mod_mono to request a /default.aspx which if it doesn't exist will return a 404
  • If you want to use a custom path i.e. /api your ASP.NET virtual path also needs to start with your httpHandler path. Which is why an ASP.NET application hosted on /ApiPath35/api works as expected whilst one at /CustomPath35/api does not.

Eating our own dogfood

ServiceStack.NET now running example projects on both Nginx/FastCGI and Apache/mod_mono on the same server

With a few linux admin tweaks to add and assign a new virtual network interface with a new IP Address, we're easily able to run both Nginx/FastCGI and Apache/mod_mono HTTP servers on the same server, both configured to point to ServiceStack ASP.NET GitHub Example Projects.

http://www.servicestack.net is running Nginx/FastCGI configuration while the sub domain http://api.servicestack.net is running Apache/mod_mono (the recommended MONO ASP.NET configuration).

Here are links to ServiceStack.Example projects on both Nginx and Apache:

We plan to create more wiki pages walking through how to setup your own ASP.NET web applications on Linux with MONO.

If you have a preference on what hosting environment you would like to see ServiceStack running in (e.g. AppHarbor, Moncai, Amazon, Azure, SuseStudio, etc), we'd love to hear from you, please post your preference to ServiceStack's Google Group

Download

.

Follow @demisbellot and @ServiceStack for twitter updates


##ServiceStack v2.0

The ServiceStack code-base has gone under a re-structure to better support user contributions, testing, fine-grained deployments allowing hosting of ServiceStack in 32 and 64 bit servers, in medium or full trust hosting environments.

The changes from a high-level are:

  • No more ILMERGE.exe dlls, all ServiceStack .dlls now map 1:1 with a project of the same name
    • As a result all .pdb's for all assemblies are now included in each release to help debugging (this was lost using ILMERGE)
    • When not using OrmLite/Sqlite, ServiceStack is a full .NET managed assembly with no P/Invokes that can run in 32/64 bit hosts
  • All projects upgraded to VS.NET 2010 (min baseline is still .NET 3.5)
  • Non-core, high-level functionality has been moved into a new ServiceStack.Contrib

Breaking Changes

A lot of effort was made to ensure that clients would not be affected i.e. no code-changes should be required.

As a result of the change to the deployment dlls where previously ServiceStack.dll was an ILMERGED combination of every implementation dll in ServiceStack. You will now need to explicitly reference each dll that you need.

To help visualize the dependencies between the various components, here is a tree showing which dependencies each project has:

Non-core Framework features extracted into new ServiceStack.Contrib project

In the interest of promoting contributions and modifications from the community, the non-core projects of ServiceStack has been extracted into a new user contributed ServiceStack.Contrib project site at:

https://github.com/ServiceStack/ServiceStack.Contrib

I invite all ServiceStack users who want to share their generic high-level functionality and useful app-specific classes under this project where the rest of the community can benefit from.

Download

.

Follow @demisbellot and @ServiceStack for twitter updates


##Service Stack 1.82 Release Notes

The biggest feature added in this release is likely the new HTML5 report format that generates a human-readable HTML view of your web services response when viewing it in a web browser. Good news is, like the ServiceStack-CSV-Format it works with your existing webservices as-is, with no configuration or code-changes required.

HTML5 Report Format

Here are some results of web services created before the newer HTML5 and CSV formats existed:

Use the ?format=[json|xml|html|csv|jsv] to toggle and view the same webservice in different formats.

New ServiceStack.Northwind Example project added

In order to be able to better demonstrate features with a 'real-world' DataSet, a new ServiceStack.Northwind project has been added which inspects the Northwind dataset from an SQLite database. A live demo is hosted at http://servicestack.net/ServiceStack.Northwind/. Here are some links below to better demonstrate the new HTML format with a real-world dataset:

Nortwind Database REST web services

Improved Caching

ServiceStack has always had its own (i.e. ASP.NET implementation-free) good support for caching, though like most un-documented features it is rarely used. The caching has been improved in this version to now support caching of user-defined formats as well. Here is example usage from the new Northwind project:

public class CachedCustomersService : RestServiceBase<CachedCustomers>
{
    public ICacheClient CacheClient { get; set; }

    public override object OnGet(CachedCustomers request)
    {
        return base.RequestContext.ToOptimizedResultUsingCache(
            this.CacheClient, "urn:customers", () => {
                var service = base.ResolveService<CustomersService>();
                    return (CustomersResponse) service.Get(new Customers());
            });
    }
}

The above code caches the most optimal output based on browser capabilities, i.e. if your browser supports deflate compression (as most do), a deflated, serialized output is cached and written directly on the response stream for subsequent calls. Only if no cache exists will the web service implementation (e.g lambda) be executed, which populates the cache before returning the response.

To see the difference caching provides, here are cached equivalents of the above REST web service calls:

Nortwind Database Cached REST web services

API Changes

The underlying IHttpRequest (an adapter interface over ASP.NET/HttpListener HTTP Requests) can now be retrieved within your webservice to be able to query the different HTTP Request properties:

var httpReq = base.RequestContext.Get<IHttpRequest>();

Also added is the ability to resolve existing web services (already auto-wired by the IOC) so you can re-use existing web service logic. Here is an example of usage from the Northwind CustomerDetailsService.cs.

var ordersService = base.ResolveService<OrdersService>();
var ordersResponse = (OrdersResponse)ordersService.Get(new Orders { CustomerId = customer.Id });

##Service Stack 1.79 Release Notes

The C#/.NET Sync and Async Service Clients were improved to include:

  • Enhanced REST functionality and access, now more succinct than ever
  • Uploading of files to ServiceStack web services using HTTP POST multipart/form-data
  • More robust error handling support handling C# exceptions over REST services
  • For examples of on how to use the C# REST client API check out the tests in the new REST Files project:

New RestFiles project added to ServiceStack.Examples GitHub project:

Live demo available at: servicestack.net/RestFiles/

Read the rest of the Rest Files README.md for a more detailed overview about the project.

##Service Stack 1.78 Release Notes

  • Added more tests and fixed bugs in ServiceStack's new CSV format and Request/Response filters

  • Added new information on the generated web service index, individual web service page now include:

    • REST paths (if any are defined) thanks to @jakescott
    • Included directions to consumers on how to override the HTTP Accept header and specify the format
    • Now including any System.CompontentModel.Description meta information attributed on your Request DTO
    • Preview the new documentation pages on ServiceStack Hello and Movies example web service pages.
  • Added tests to show how to implement Basic Authentication using the new RequestFilters

  • Changed the httpHandler paths in the Example projects and created a new Config class to store which supported mappings go with which web servers + middleware.

  • Provide a way to register new urls for different ServiceStack handler mappings used, e.g. to register IIS 6.0 urls:

    SetConfig(new EndpointConfig { ServiceEndpointsMetadataConfig = ServiceEndpointsMetadataConfig.GetForIis6ServiceStackAshx() });
    

##Service Stack 1.77 Release Notes

This release was focused to opening up ServiceStack to better support adding more hooks and extension points where new formats can be added. The CSV format was also added to test these new extension APIs.

Main features added in this release:

  • Added support for the CSV format
  • Enhanced the IContentTypeFilter API to add support for different serialization formats
  • Added Request and Response filters so custom code can inspect and modify the incoming IHttpRequest or IHttpResponse.
  • Added Request.Items so you can share arbitrary data between your filters and web services.
  • Added Request.Cookies for reading cookies (to avoid retrieving it from HttpRuntime.Current)
  • Removed the preceding UTF8 BOM character to ServiceStack's JSON and JSV Serializers.
  • All features above are available on both ASP.NET and HttpListener hosts

Using the same tech that makes ServiceStack's JSV and JSON serializers so fast (i.e. no run-time reflection, static delegate caching, etc), should make it the fastest POCO CSV Serializer available for .NET.

The 'CSV' format is the first format added using the new extensions API, which only took the following lines of code:

//Register the 'text/csv' content-type and serializers (format is inferred from the last part of the content-type)
this.ContentTypeFilters.Register(ContentType.Csv,
	CsvSerializer.SerializeToStream, CsvSerializer.DeserializeFromStream);

//Add a response filter to add a 'Content-Disposition' header so browsers treat it as a native .csv file
this.ResponseFilters.Add((req, res, dto) =>
	{
		if (req.ResponseContentType == ContentType.Csv)
		{
			res.AddHeader(HttpHeaders.ContentDisposition,
				string.Format("attachment;filename={0}.csv", req.OperationName));
		}
	});

With only the code above, the 'CSV' format is now a first-class supported format which means all your existing web services can take advantage of the new format without any config or code changes. Just drop the latest ServiceStack.dlls (v1.77+) and you're good to go!

Note: there are some limitations on the CSV format and implementation which you can read about on the ServiceStack CSV Format page.

Request and Response Filters:

The Request filter takes a IHttpRequest, IHttpResponse and the Request DTO: List<Action<IHttpRequest, IHttpResponse, object>> RequestFilters { get; }

The Response filter takes a IHttpRequest, IHttpResponse and the Response DTO: List<Action<IHttpRequest, IHttpResponse, object>> ResponseFilters{ get; }

Note: both sets of filters are called before there any output is written to the response stream so you can happily use the filters to authorize and redirect the request. Calling IHttpResponse.Close() will close the response stream and stop any further processing of this request.

Feel free to discuss or find more about any of these features at the Service Stack Google Group

<Wiki Home



  1. Getting Started
    1. Create your first webservice
    2. Your first webservice explained
    3. ServiceStack's new API Design
    4. Designing a REST-ful service with ServiceStack
    5. Example Projects Overview
  2. Reference
    1. Order of Operations
    2. The IoC container
    3. Metadata page
    4. Rest, SOAP & default endpoints
    5. SOAP support
    6. Routing
    7. Service return types
    8. Customize HTTP Responses
    9. Plugins
    10. Validation
    11. Error Handling
    12. Security
  3. Clients
    1. Overview
    2. C# client
    3. Silverlight client
    4. JavaScript client
    5. Dart Client
    6. MQ Clients
  4. Formats
    1. Overview
    2. JSON/JSV and XML
    3. ServiceStack's new HTML5 Report Format
    4. ServiceStack's new CSV Format
    5. MessagePack Format
    6. ProtoBuf Format
  5. View Engines 4. Razor & Markdown Razor
    1. Markdown Razor
  6. Hosts
    1. IIS
    2. Self-hosting
    3. Mono
  7. Security
    1. Authentication/authorization
    2. Sessions
    3. Restricting Services
  8. Advanced
    1. Configuration options
    2. Access HTTP specific features in services
    3. Logging
    4. Serialization/deserialization
    5. Request/response filters
    6. Filter attributes
    7. Concurrency Model
    8. Built-in caching options
    9. Built-in profiling
    10. Messaging and Redis
    11. Form Hijacking Prevention
    12. Auto-Mapping
    13. HTTP Utils
    14. Virtual File System
    15. Config API
    16. Physical Project Structure
    17. Modularizing Services
    18. MVC Integration
  9. Plugins 3. Request logger 4. Swagger API
  10. Tests
    1. Testing
    2. HowTo write unit/integration tests
  11. Other Languages
    1. FSharp
    2. VB.NET
  12. Use Cases
    1. Single Page Apps
    2. Azure
    3. Logging
    4. Bundling and Minification
    5. NHibernate
  13. Performance
    1. Real world performance
  14. How To
    1. Sending stream to ServiceStack
    2. Setting UserAgent in ServiceStack JsonServiceClient
    3. ServiceStack adding to allowed file extensions
    4. Default web service page how to
  15. Future
    1. Roadmap

Clone this wiki locally