servicestack

ServiceStack Rest - Complex uri hierarchies

与世无争的帅哥 提交于 2019-12-24 07:55:18
问题 I'm creating a rest webservice using the c# framework 'servicestack' (http://www.servicestack.net/) and I'm having issues trying to figure out how to support more complex rest hierarchies And I'm configuring various routes and it works perfectly Routes .Add<MerchantDto>("/merchants") .Add<MerchantDto>("/merchants/{id}") .Add<MerchantDto>("/merchantGroups/{merchantGroupId}/merchants") .Add<MerchantDto>("/merchantGroups/{merchantGroupId}/merchants/{id}") .Add<StoreDto>("/stores") .Add<StoreDto>

Authentication and Authorization with ASP.NET Core and Service Stack

可紊 提交于 2019-12-24 07:13:53
问题 I have a ASP.Net Core MVC Web App that users needs to logon to get the id_token from the IdentityServer4 and then that id_token will be passed to webapi implemented in ServiceStack to obtain the authorization code. The subsequent call to the webapi will use the authorization code. So far what I have read is for the Web App, it should use openid cookie token (UseOpenIdConnectAuthentication). For the webapi, it should use the bearer token. My question is how I can pass that http only cookie

browser refresh - lost servicestack authentication session data

China☆狼群 提交于 2019-12-24 07:05:34
问题 I have an angular.js single page app that authenticates against a RESTful API (Servicestack). This all works fine. When the response from the authentication api is returned the username is stored on an Angular service and an isAuthenticated flag is set to true. Any requests against an [Authenticate] attributed web service then returns data. My issue is that when I refresh the browser my javascript angular objects are flushed and the fact the user authenticated is forgotten. Yet when I call

JsonSerializer not serializing derived class properties

陌路散爱 提交于 2019-12-24 06:46:01
问题 I have a class like below which is added to the project/solution as reference public class FileContents { public List<RecordBase> Records { get; set; } } public class RecordBase { public int LineNumber { get; set; } } There few other class which are not added to the reference but dynamicaly loaded and those classes are derived from RecordBase class the below is the snippet on how it is loaded var fileContents = new FileContents(); var dll = Assembly.LoadFile(derivedClassesAssemblyLocation);

ServiceStack and AWS: Created a ASP.NET Empty project, but cannot select .NET Core in target framework

谁都会走 提交于 2019-12-24 06:27:31
问题 I started a ServiceStack ASP.NET Empty project in VS2019, as that was the closest thing I could find to what I wanted. The template is right on, but I want to run it in .NET Core. However, the Target framework was set to .NET Framework 4.5, but I wanted it to be .NET Core 2.1+, and I cannot select it either: I know that I have .NET Core installed, cause I have been developing a Blazor app also in VS2019, which is .NET Core. I'd like to know what I am missing here. ---- EDIT ---- Here is the

ServiceStack.Redis Unable to read transport - BasicRedisClientManager

跟風遠走 提交于 2019-12-24 06:27:09
问题 I am getting the following error intermittently when trying to read a redis list via ServiceStack.Redis: "Unable to read data from the transport connection: An established connection was aborted by the software in your host machine". I am wondering if my entire concept of how to reliably connect and pool connections to Redis using ServiceStack is wrong. This is my code for connecting using a sealed class and singleton pattern: public sealed class RedisClientBase { public

ServiceStack.Redis Unable to read transport - BasicRedisClientManager

血红的双手。 提交于 2019-12-24 06:27:05
问题 I am getting the following error intermittently when trying to read a redis list via ServiceStack.Redis: "Unable to read data from the transport connection: An established connection was aborted by the software in your host machine". I am wondering if my entire concept of how to reliably connect and pool connections to Redis using ServiceStack is wrong. This is my code for connecting using a sealed class and singleton pattern: public sealed class RedisClientBase { public

ServiceStack and AWS: Created a ASP.NET Empty project, but cannot select .NET Core in target framework

假装没事ソ 提交于 2019-12-24 06:25:11
问题 I started a ServiceStack ASP.NET Empty project in VS2019, as that was the closest thing I could find to what I wanted. The template is right on, but I want to run it in .NET Core. However, the Target framework was set to .NET Framework 4.5, but I wanted it to be .NET Core 2.1+, and I cannot select it either: I know that I have .NET Core installed, cause I have been developing a Blazor app also in VS2019, which is .NET Core. I'd like to know what I am missing here. ---- EDIT ---- Here is the

Deserialize Root Object in ServiceStack Explicit Response DTO

可紊 提交于 2019-12-24 06:14:32
问题 I'm consuming a third party WebApi using ServiceStack. Imagine this API has the following route. https://api.example.com/v1/people/{id} returns the person with the specified ID. JSON: { "id": 1, "name": "Jean-Luc Picard" } I could consume this with the following C# code. class Program { static void Main(string[] args) { var client = new JsonServiceClient("https://api.example.com/v1/"); Person person = client.Get(new GetPerson() { ID = 1 }); } } [Route("/people/{id}")] public class GetPerson :

Dynamically adding attributes in ServiceStack

此生再无相见时 提交于 2019-12-24 05:53:11
问题 I'm attempting to add a "Restrict" attribute in my AppHost. Here is my code: var restrictAttribute = new RestrictAttribute { ExternalOnly = true }; foreach (var dto in dtos) { dto .AddAttributes(restrictAttribute); } The DTOs I'm adding them to are ones specifically for POST requests. The problem I'm facing is that after adding the attributes dynamically, the ServiceStack functionality for the restrict doesn't work. It DOES add the attribute, but doesn't actually restrict anything. The only