servicestack

Does ServiceStack support binary responses?

一世执手 提交于 2019-12-17 06:14:06
问题 Is there any mechanism in ServiceStack services to return streaming/large binary data? WCF's MTOM support is awkward but effective in returning large amounts of data without text conversion overhead. 回答1: From a birds-eye view ServiceStack can return any of: Any DTO object -> serialized to Response ContentType HttpResult, HttpError, CompressedResult (IHttpResult) for Customized HTTP response The following types are not converted and get written directly to the Response Stream: String Stream

servicestack deserializing JSON in query string variable

时光总嘲笑我的痴心妄想 提交于 2019-12-14 02:23:50
问题 in the rest service i am emulating the same as another product, json is GET/POSTed in web form or query string parameters. My request DTO has another DTO object as a property for the json I can add a RequestFilter to deserialize the form parameters if it is POSTed, but if GET is used with json in a query variable the service stack code will throw an "KeyValueDataContractDeserializer: Error converting to type" exception in StringMapTypeDeserializer. In StringMapTypeDeserializer it gets a parse

“Virtual file not found” after upgrade from ServiceStack 3.9 to 4.0.5

风格不统一 提交于 2019-12-14 02:17:21
问题 I have an old ASP.NET project, which I just upgraded from .NET 3.5 and ServiceStack to .NET 4.0 and ServiceStack 4.0.5. However, I get a strange error while starting. This exception is not the first one in ServiceStack, there is an null pointer exception earlier that is caught. Any ideas? The only previous question I see about is this, which talks about F#. I have an F# dll, but that one is not used in the startup. Server Error in '/' Application. Virtual file not found Description: An

ServiceStack client compression

时光总嘲笑我的痴心妄想 提交于 2019-12-14 02:10:31
问题 I want to compress the request sent from a client. I've found the Q/A: ServiceStack - How To Compress Requests From Client But when using this code I get a SerializationException from the server that the content should start with a '{' and not '\u001F...' Is this solution still valid or is there another way to compress client request payload? UPDATE 1: Here is the output from Fiddler. Request: POST http://xxxxxx:8104/entries HTTP/1.1 Accept: application/json User-Agent: ServiceStack .NET

How can we remove specific user's session in ServiceStack?

房东的猫 提交于 2019-12-14 01:09:00
问题 Admin can disable or suspend user's entrance. We can check "is user disabled" in "user login". ("Checking Db for each request" is not good option) So we want to remove user's session when admin disables it's account. How can we achieve it? 回答1: If you know or have kept the sessionId you can remove a session from the cache with: using (var cache = TryResolve<ICacheClient>()) { var sessionKey = SessionFeature.GetSessionKey(sessionId); cache.Remove(sessionKey); } But ServiceStack doesn't keep a

Server Sent Events with CORS support

≡放荡痞女 提交于 2019-12-13 18:28:38
问题 I am using Server Sent Events in ServiceStack and I need to allow its use across origins. I have setup the ServiceStack CorsFeature in my application, but this is not honoured by the ServerEventsFeature . I can manually add the Access-Control-Allow-Origin header in the OnCreated , and that allows requests to event-stream , but requests to the heartbeat fail, because I cannot set a header on this request. Plugins.Add(new ServerEventsFeature { HeartbeatInterval = new TimeSpan(0,0,30), OnCreated

jQuery Ajax Request not found, ServiceStack cross domain

早过忘川 提交于 2019-12-13 18:23:04
问题 ServiceStack (9.54), POST request with JQuery AJAX. cross domain request, prompts an Error "Request not found". the service is self-hosted as windows service. FireWall is off. I have done, what I read, in ServiceStack for cross domain calls (CORS), but without result. In the web page, the code (which works successfully on localhost) is the following. jQuery.support.cors = true; CallTest() { $.ajax({ type: 'POST', url: 'http://dev.testhost.com:18162/TestAPI', data: JSON.stringify(myRequest),

Servicestack with Autofac not resolving IRequestContext

旧巷老猫 提交于 2019-12-13 17:17:29
问题 I am trying to use the Cache facilities of Service Stack. These are accessed through the RequestContext, which is injected by the IOC in your Service. This works as expected if you are using the default Funq IOC, it does not work when you hook AutoFac, RequestContext is null and I am not sure how to configure autofac to build it. Any clues here? My AutoFac configuration: var builder = new ContainerBuilder(); //Now register all dependencies to your custom IoC container builder

Object doesn't support property or method 'json' servicestack-client HTTP post

霸气de小男生 提交于 2019-12-13 17:07:22
问题 servicestack-client version 1.0.9 Microsoft Edge 38.14393.2068.0 Microsoft EdgeHTML 14.14393 I am getting the following Javascript error in Microsoft Edge 38.14393.2068.0: "Object doesn't support property or method 'json'" I suspecting that this Microsoft Edge Javascript error is coming from the ServiceStack Typescript JsonServiceClient, you can find this npm package's source code is here Use the standalone app below to reproduce this issue in MS Edge: clone this repository, just follow these

Turn Off ServiceStack Logging

本小妞迷上赌 提交于 2019-12-13 16:24:12
问题 ServiceStack's internal logging isn't something I want to have in my logs. How do we disable the internal logging, or at least suppress it so it doesn't clog the log? 回答1: When configuring your LogManager just set it to an instance of NullLogFactory LogManager.LogFactory = new NullLogFactory(); 来源: https://stackoverflow.com/questions/18598391/turn-off-servicestack-logging