servicestack

Routing path with ServiceStack

强颜欢笑 提交于 2019-12-12 13:19:19
问题 I'm using AngularJS, I want to do the following routing on ServiceStack-serving-static-html Note the intercept any path on the screenshot. Also note I'm not using ServiceStack for REST, I'm using it as pure webserver for serving static contents, e.g. html Is it possible to do that on ServiceStack? 回答1: This is node.js code, you haven't shown any C# ServiceStack AppHost code here. ServiceStack by default supports serving of static content via HTTP, although to serve static content from the

MVC4 and ServiceStack session in Redis

 ̄綄美尐妖づ 提交于 2019-12-12 12:16:23
问题 I have a brand new MVC4 project on which I have installed the ServiceStack MVC starter pack (version 4.0.12 from MyGET) to bootstrap the usage of the service stack sessions. In my AppHost my custom session is configured as: Plugins.Add(new AuthFeature(() => new CustomUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(config) })); The custom session looks like this for testing purposes: public class CustomUserSession : AuthUserSession { public string Hello { get; set; } } And the

How to get all keys that match a specific pattern from a hash in redis?

依然范特西╮ 提交于 2019-12-12 11:32:39
问题 I would like to get all keys, with its values, from a hash, where the keys match a specific pattern. I use redis with the c# library ServiceStack.Redis. I have found the command Keys with a pattern : http://redis.io/commands/keys if it is simple string_key -- string_val but nothing if its within a hash. There is List<string> GetValuesFromHash(string hashId, params string[] keys); but it only works if the keys perfectyl match the keys in redis. A key:* would return null e.g. myHash = key:1 --

ServiceStack Razor web.config

怎甘沉沦 提交于 2019-12-12 10:53:50
问题 <configSections> <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> <section name="pages" type="System.Web.WebPages.Razor.Configuration

Final message in server events not being pushed until heartbeat

雨燕双飞 提交于 2019-12-12 10:48:40
问题 We are having an issue with the final message sent over service stack waiting until the next heart beat to be sent. We believe it to be similar to : Servicestack server sent events However, res.Write() is now deprecated and res.WriteAsync() throws: System.InvalidOperationException: This operation cannot be performed after the response has been submitted I have also tried to solve the issue stated in the above thread by using : // Remove url compression https://stackoverflow.com/questions

path parameters w/ URL unfriendly characters

为君一笑 提交于 2019-12-12 09:57:34
问题 Using service stack 3.9.21. Hosting the app in IIS 7.5. Using an Integrated 4.0.30319 ASP.NET app pool. For illustration purposes let's say I have the following path (that is backed by a DTO and a corresponding request handler): /cars/{id} Some cars' ids have characters in them that I suppose have to be URL encoded - pipe, |, is one of them. When I send requests to fetch a car with for example an id of '1|2' I get a good old 500 with the following stack trace: [ArgumentException]: Illegal

ServiceStack response filter “short circuiting” causing problems

杀马特。学长 韩版系。学妹 提交于 2019-12-12 09:55:01
问题 We have embraced SS as our REST server platform and love it - one of the recurring issues I face deals with logging requests that have been "short circuited" for one legitimate reason or another (errors, missing mandatory headers, etc). I am finding that I have to add extra logging code to many different code exit (ie short circuited) points because I still want to capture the request in the logs. Am I doing something wrong here? is there a way to specify a "mandatory response filter" that

Configure ServiceStack Base URI

大城市里の小女人 提交于 2019-12-12 09:44:24
问题 I'm creating a self-hosted REST service using service stack & AppHostHttpListenerBase. I'd like to use a base URI for my services (e.g. "api") like so: http://myserver/api/service1/param http://myserver/api/service2/param How do I do this without defining "api" in each of my routes. In IIS, I can set a virtual directory to isolate the services, but how do I do this when self-hosting? 回答1: ServiceStack's HttpListener hosts expects to be hosted a the root / path as the normal use-case is to

Block access to Redis key (ServiceStack)

ぐ巨炮叔叔 提交于 2019-12-12 09:09:56
问题 I'm trying to implement what I would think is a very common caching scenario using the ServiceStack Redis client, yet I'm having difficulty finding a good example of this. In an ASP.NET MVC app, we make a relatively long-running (and metered) call to an external web service and cache the results for a certain period of time. In the cache implementation, it is desired to block additional requests for that key until the web service call has completed, to avoid additional (expensive) calls. So,

ServiceStack Request and Response Objects

假如想象 提交于 2019-12-12 08:16:10
问题 Is it ok (read good practice) to re-use POCO's for the request and response DTO's. Our POCO's are lightweight (ORM Lite) with only properties and some decorating attributes. Or, should I create other objects for the request and/or response? Thanks, 回答1: I would say it depends on your system, and ultimately how big and complex it is now, and has the potential to become. The ServiceStack documentation doesn't specify which design pattern you should use. Ultimately it provides the flexibility