ServiceStack Request DTO design

To give you a flavor of the differences you should think about when designing message-based services in ServiceStack I’ll provide some examples comparing WCF/WebApi vs ServiceStack’s approach: WCF vs ServiceStack API Design WCF encourages you to think of web services as normal C# method calls, e.g: public interface IWcfCustomerService { Customer GetCustomerById(int id); List<Customer> GetCustomerByIds(int[] … Read more

ServiceStack REST API and CORS

Using the CorsFeature plugin Enabling Global CORS support We now have a CorsFeature which wraps CORS headers into the Plugin below to make it much easier to add CORS support to your ServiceStack services. Commonly this is now all that’s needed: Plugins.Add(new CorsFeature()); Which uses the default values: CorsFeature(allowedOrigins:”*”, allowedMethods:”GET, POST, PUT, DELETE, OPTIONS”, allowedHeaders:”Content-Type”, … Read more

What is the best way to run ServiceStack on Linux / Mono?

Update for Linux From the v4.5.2 Release ServiceStack now supports .NET Core which offers significant performance and stability improvements over Mono that’s derived from a shared cross-platform code-base and supported by Microsoft’s well-resourced, active and responsive team. If you’re currently running ServiceStack on Mono, we strongly recommend upgrading to .NET Core to take advantage of … Read more

Could not load file or assembly System.Runtime.CompilerServices.Unsafe

Could not load file or assembly System.Runtime.CompilerServices.Unsafe It seems that you have installed System.Runtime.CompilerServices.Unsafe nuget package 4.5.3 version. And it corresponds to System.Runtime.CompilerServices.Unsafe.dll assembly version 4.0.4.1. Suggestion 1) Please try to register System.Runtime.CompilerServices.Unsafe version 4.0.4.1 into GAC so that the system can it. Run Developer Command Prompt for VS2019 as Administrator type: cd xxxxx (the … Read more

Recommended ServiceStack API Structure

Firstly “Best” solution is a fairly subjective term. I’ll generally aim for DRY, re-usable, performant solutions that promotes the least effort, friction and chattiness, whilst others may define “Best” in how closely it follows the principles of REST. So you will get varied responses depending on what the goals are. I can only offer how … Read more

REST actions and URL API design considerations

Short answer: Use actions at the end of the url to change state. Github does it like this to star a gist: PUT /gists/:gist_id/star Explained here https://developer.github.com/v3/gists/#star-a-gist Long Answer: Your objective is making your applications effortless to use an intuitive. Your users should use your app in the simplest possible way. Your users should not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)