servicestack

How to find Service from ServiceStack RequestFilter

此生再无相见时 提交于 2019-12-18 05:23:13
问题 I'm trying to implement a RequestFilter that conditionally executes, based on information in the Service that would get invoked. I'd like to make the RequestFilter find the Service , look at it for a method/interface/attribute, and conditionally do its work based on that. I'm aware that you can declare a RequestFilterAttribute on the Service , but I couldn't figure out a good way to make it conditional. I wanted to pass a delegate/lambda into the attribute, but C# doesn't allow that. I could

ServiceStack IReturn

耗尽温柔 提交于 2019-12-18 03:32:34
问题 I am looking at the new api that came out 2 weeks ago. It seems like ReqDTO : IReturn<List<ResDTO>> { //... } The "IReturn" bit seems to be optional? The DTOs in RazorRockstars demo project works without it. 回答1: This is a new addition in ServiceStack's New API which allows you to document the expected Response Type that the Request DTO will return, e.g. with ReqDTO : IReturn<List<ResDTO>> { ... } Which lets you call using any of the C# Service Clients with: List<ResDTO> response = client.Get

How do I authorize access to ServiceStack resources using OAuth2 access tokens via DotNetOpenAuth?

大城市里の小女人 提交于 2019-12-18 03:32:21
问题 I've created an OAuth2 authorization server using DotNetOpenAuth, which is working fine - I'm using the resource owner password flow, and successfully exchanging user credentials for an access token. I now want to use that access token to retrieve data from secure endpoints in a ServiceStack API, and I can't work out how to do so. I've examined the Facebook, Google, etc. providers included with ServiceStack but it's not clear whether I should be following the same pattern or not. What I'm

ServiceStack IReturn

二次信任 提交于 2019-12-18 03:32:04
问题 I am looking at the new api that came out 2 weeks ago. It seems like ReqDTO : IReturn<List<ResDTO>> { //... } The "IReturn" bit seems to be optional? The DTOs in RazorRockstars demo project works without it. 回答1: This is a new addition in ServiceStack's New API which allows you to document the expected Response Type that the Request DTO will return, e.g. with ReqDTO : IReturn<List<ResDTO>> { ... } Which lets you call using any of the C# Service Clients with: List<ResDTO> response = client.Get

ServiceStack default format

空扰寡人 提交于 2019-12-18 02:18:09
问题 I would like to set ServiceStack's default format to JSON, as opposed to the HTML formatted response it normally returns when a service is accessed from a browser. I know this can be specified on each request by sending a ?format=json parameter or setting the Accept header to application/json. Is there a way to change this without having to rely on these hints from the request? 回答1: In addition to specifying it on the QueryString with ?format=json , by appending the format .ext to the end of

Is this a valid usage of ServiceStack Redis?

徘徊边缘 提交于 2019-12-17 23:13:29
问题 I am new to Redis (using it at a hosted service) and want to use it as a demonstration / sandbox data storage for lists. I use the following piece of code. It works - for me. But is it a valid (and not completely bad practice) usage for a small web site with several (up to 100) concurrent users (for a small amount of data - up to 1000 list items)? I'm using static connection and a static redisclient typed list like this: public class MyApp { private static ServiceStack.Redis.RedisClient

Json Format data from console application to service stack

心已入冬 提交于 2019-12-17 19:53:37
问题 I found you are the only one who answers for service stack, I don't have emails and what ever you provided for last questions to me, seems fine. I have seen your profile and as you are the main founder of mythZ, i seems to ask you my question again. For one of my question, POST data in JSON format to Service stack, i appreciate your answer. your answer is right, however in my case i am having following case.Let me describe in more detail. I have seen "Hello World" example of service stack. I

Using ServiceStack to upload image files

旧巷老猫 提交于 2019-12-17 18:59:27
问题 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? 回答1: 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

Sending Data to ServiceStack RESTful service, getting 'Access is denied'

耗尽温柔 提交于 2019-12-17 16:54:08
问题 I built a RESTful service with ServiceStack which sends data to a database. I've tested it locally and it works great. When I deploy it to a server and run the same code, which is a jQuery $.ajax call, I get an 'Access is denied' error. I have setup CORS in my ServiceStack config using the plugin as explained here. I also set the crossDomain to true in my ajax call. I can't think of what else to do to get this to work, and I'm honestly not sure where this error is being thrown. I've stepped

Why am I getting error “The type 'IReturn<>' is defined in an assembly that is not referenced” using ServiceStack in VIsualStudio 2017

懵懂的女人 提交于 2019-12-17 14:18:49
问题 I am running Visual Studio 2017 15.6.3. I have a .NET Standard 2.0 DLL project which contains Request and Response classes for use with ServiceStack. The Request classes implement IReturn<>. I have a .NET Core 2.0 console EXE project which references the .NET Standard DLL. This EXE uses a ServiceStack JsonServiceClient to send requests to a ServiceStack service. It compiles and works fine. I added a .NET Framework 4.6.1 console EXE project which also references the .NET Standard 2.0 DLL. It