servicestack

Is ResponseStatus needed in ServiceStack?

╄→гoц情女王★ 提交于 2019-11-28 11:03:32
Is ResponseStatus needed? The wiki says that we need to have a ResponseStatus property in our response DTO to handle exception serialization: https://github.com/ServiceStack/ServiceStack/wiki/Validation However it looks like ResponseStatus is generated automatically even if there is no ResponseStatus property in the response DTO. Do we need the ResponseStatus property? The Error Handling Docs explains how you can control which Services return a populated ResponseStatus DTO, i.e: Error Response Types The Error Response that gets returned when an Exception is thrown varies on whether a

Can ServiceStack Runner Get Request Body?

烈酒焚心 提交于 2019-11-28 10:00:02
Is it possible, without major hackery, to get the raw request body of a ServiceStack request within the Runner? I am writing an oauth service provider to run on top of ServiceStack using the new API (Service and Runner). Due to how OAuth signing works I need to get the raw request body for each request. The OAuth protection layer is added to the Runner so that an invalid OAuth request can easily return an empty/error response without any boilerplate in the Service class or subclassing a special "OAuthService" class. The way to access the Raw Request Body is to use IHttpRequest.GetRawBody() or

Multiple Optional Parameters with ServiceStack.Net

一曲冷凌霜 提交于 2019-11-28 09:52:30
I'm trying to implement a service with Multiple Optional Parameters using ServiceStack.Net At the moment my route looks like this Routes.Add<SaveWeek>("/save/{Year}/{Week}"); I want to support uris like this: /save/2010/12/Monday/4/Tuesday/6/Wednesday/7 ie Monday=4, Tuesday=6 and Wednesday=7 However I want the ability to ignore days i.e. the person calling the service can decide if they want to save each value for each day... i.e. Like this with missing parameter values ?Monday=4&Wednesday=7&Friday=6 Of course one solution would be to have the following route and just pass 0 when I don't want

ServiceStack benchmark continued: why does persisting a simple (complex) to JSON slow down SELECTs?

半腔热情 提交于 2019-11-28 09:39:05
问题 So, mythz didnt like my no-so-scientific benchmark question in a previous SO question, but since I would like to switch over to OrmLite, I need to figure out if it is slow, and if so, why. In my "research", I come to the conclusio that complex objects, that in OrmLite are blobbed to JSON, is the culprit of very slow SELECTs. Therefore, I created a new project that focuses solely on OrmLite, and does not compare with anything else other than itself, and the aim here is to see the differences

Using ServiceStack to upload image files

為{幸葍}努か 提交于 2019-11-28 09:27:11
We have a requirement to upload images using ServiceStack APIs. I am aware of two possible ways: 1) Use JSON object to upload file (Using BASE64 string). 2) Use "multipart/form-data" Is there any other way of uploading files using ServiceStack? Which is better in terms of best practices? The best way to upload files in ServiceStack is to just do a normal HTTP File upload see the source code for imgur.servicestack.net or file uploads in RestFiles for examples. If you don't want to send multipart/form-data then use a binary format like Protocol Buffers support in ServiceStack and send byte[] to

PUT handler not found with serviceStack on IIS7.5

狂风中的少年 提交于 2019-11-28 08:59:31
问题 I am currently using serviceStack for creating REST based services which are hosted in a MVC web application. So far ServiceStack has been amazing and I have achieved to get most of what I wanted to do working. All this works in IISExpress. I have now moved over to IIS 7.5 and I get the 400 error that the "Handler for Request not found" when doing a PUT. GET works fine and on IISExpress both PUT and GET work. On IISExpress this all worked. Any ideas? 回答1: Some info about IIS + PUT/DELETE

ServiceStack web services security

不羁岁月 提交于 2019-11-28 08:41:27
Hi I am new to working with Servicestack and have downloaded their very comprehensive bootstrapapi example and am working with it, but am still having some issues. The issue is with security, what is happening is I am getting 405 errors when trying to access the protected services. Using the authenticate service it appears that I am authenticating correctly. Please help and explain. Here is the code: public class Hello { public string Name { get; set; } } public class AuthHello { public string Name { get; set; } } public class RoleHello { public string Name { get; set; } } public class

ServiceStack.OrmLite - how to include field from foreign key lookup?

孤街浪徒 提交于 2019-11-28 07:52:26
I'm trying out the ServiceStack MVC PowerPack, and am trying the included OrmLite ORM and am trying to get data from a table referenced by a foreign key without any idea how to do so. In the OrmLite examples that use the Northwind database, for example, would it be possible to return a Shipper object that included the "ShipperTypeName" as a string looked up through the foreign key "ShipperTypeID"? From http://www.servicestack.net/docs/ormlite/ormlite-overview , I'd like to add the ShipperName field to the Shipper class if possible: [Alias("Shippers")] public class Shipper : IHasId<int> {

ServiceStack - Is there a way to force all serialized Dates to use a specific DateTimeKind?

 ̄綄美尐妖づ 提交于 2019-11-28 07:35:18
I have a POCO like this: public class BlogEntry { public string Title { get; set; } public DateTime Date { get; set; } } Most of the time it's being hydrated from Entity Framework, but it can and will be used outside of Entity Framework. The DateTimeKind for the Date from EF is Unspecified, which from what I read is normal. When I cache this POCO in Redis (using the ServiceStack Redis client), it comes back with a DateTimeKind of Local. So there is a jitter with the returned objects. The first pass (uncached) has ISO-8061 with no offset (DateTimeKind.Unspecified). The second pass (cached) is

Binary data corrupted when hosting ServiceStack in Mono + FastCGI

混江龙づ霸主 提交于 2019-11-28 05:33:05
问题 I have a ServiceStack service with a method to handle a GET request. This method returns binary data. public object Get(DownloadFile request) { return new HttpResult(new FileInfo("some file"), "application/octet-stream", asAttachment: true); } When the host is Windows it works fine but when I'm running it in Linux with Mono+FastCGI the data I download is not the same. I analyzed the returned bytes for a few files and concluded that there is a pattern. The data is getting wrapped in this way: