servicestack

ServiceStack Global Request Filter Not Firing

巧了我就是萌 提交于 2019-12-10 12:56:56
问题 I have a global request filter for authentication as suggested by mythz (ServiceStack dev), in this SO Answer My filter: RequestFilters.Add((httpReq, httpResp, requestDto) => { if (!PublicRoutes.Contains(httpReq.PathInfo)) { new AuthenticateAttribute().Execute(httpReq, httpResp, requestDto); } }); The filter does not fire for me when I request ServiceStack Razor pages that inherit dynamic ViewPage Example /Default.cshtml: @inherits ViewPage <!DOCTYPE html> <html> <head> <title>HOME</title> ..

Is there a build issue in the recent versions of ServiceStack 3?

99封情书 提交于 2019-12-10 12:45:32
问题 I have had the following warning show up in visual studio when compiling a project using ServiceStack 3.9.71.0 (seems to affect most recent releases too). Not sure why it hasn't shown up before but it has started showing up after I created a test lib which references my main project and both have references to the same service stack DLLs: Warning 2 Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the

Troubles using WebRequest in Mono

喜夏-厌秋 提交于 2019-12-10 12:28:05
问题 I have a really strange problem with WebRequest in a ServiceStack web application (hosted by XSP on Mono). It seems that the registration of request modules works in a very strange way; I am using WebRequest to create an HTTP request, and it is failing because it was not able to find a creator for that "prefix" (HTTP). The exception I am seeing is NotSupportedException , and I was able to track it to the fact that no creator is registered for the HTTP prefix (I am hitting https://github.com

How do I upload an image to a ServiceStack service?

為{幸葍}努か 提交于 2019-12-10 11:48:00
问题 I have the path of an image, and use the following code to send it to my server; HttpWebRequest client = (HttpWebRequest)WebRequest.Create("http://212.175.132.168/service/api/upload/cab.jpg"); client.Method = WebRequestMethods.Http.Post; // the following 4 rows enable streaming client.AllowWriteStreamBuffering = false; client.SendChunked = true; client.ContentType = "multipart/form-data;"; client.Timeout = int.MaxValue; using (FileStream fileStream = System.IO.File.OpenRead (filePath)) {

What is the most time efficient way to serialize/deserialize a DataTable to/from Redis?

亡梦爱人 提交于 2019-12-10 11:26:13
问题 I want to store complex objects such as a DataTable or Dataset , etc, in Redis. I have tried to serialize them as a BLOB object using JsonSerialize , but it takes too much time. Is there any other way? 回答1: Unfortunately when working with large data sets it will always take time to serialize and deserialize the structure. DataTable s in particular are fairly complex objects, as they have rows and columns which often have a lot of meta data attached to them - even when it appears to be a basic

Consuming Web Service HTTP Post

我是研究僧i 提交于 2019-12-10 10:57:34
问题 I'm consuming a web-service with ServiceStack. The header expected is: POST /SeizureWebService/Service.asmx/SeizureAPILogs HTTP/1.1 Host: host.com Content-Type: application/x-www-form-urlencoded Content-Length: length jsonRequest=string I'm trying to consume it with this code: public class JsonCustomClient : JsonServiceClient { public override string Format { get { return "x-www-form-urlencoded"; } } public override void SerializeToStream(ServiceStack.ServiceHost.IRequestContext

What's the precise differences between the following three lines in a MVC controller inheriting from ServiceStackController

北城以北 提交于 2019-12-10 10:44:49
问题 What's the precise differences between the following three lines in a MVC controller inheriting from ServiceStackController? (I cannot find the difference explained in any documentation) //A - (default: reload = true) var session = GetSession(); //B var session = GetSession(false); //C var session = SessionAs<IAuthSession>(); 回答1: GetSession is better named GetOrCreateSession as it will either Get a Typed Session or create a new one if it doesn't exist. It also stores the instance of the

401 error when using [Authenticate] with BasicAuthProvider

大城市里の小女人 提交于 2019-12-10 10:16:47
问题 I'm having some trouble with authenticating with ServiceStack using the BasicAuthProvider. All works well when I authenticate using the provider route 'auth/myauth' but when I go to one of my other service DTOS that use the [Authenticate] attribute e.g. /hello, I always get a 401 Unauthorized error even when I always supply the basic authentication details in the 'Authorization' header using beforeSend with jQuery. Basically, I'm building an API for a mobile app that involves credential

How to get Swagger Plugin working within self hosted servicestack

99封情书 提交于 2019-12-10 09:55:23
问题 I've re-asked this question with examples provided on github and a drop box download link for anyone that want to run the code themselves : Swagger not working on a self hosted ServiceStack Service I had my servicestack JSON service running inside my website solution, under the '/api/ path, but now I'd like to split out that service stack portion and have it running as a self hosted windows service. My problem is, myself and the other developers find the Swagger plugin very useful for testing

ServiceStack OrmLite How can I achieve automatic setting of foreign key/related properties?

拜拜、爱过 提交于 2019-12-10 09:30:25
问题 I have created the following example to test Foreign Keys and up to this point, it works well. What I would like to be able to do, is use this framework that I built to set the property of the relationship and have it Save the child object when the Parent is saved and automatically set the PrimaryKey and Foreign Key. The DataManager class exposes the Connection public class DataManager { DataManager() { OrmLiteConfig.DialectProvider = SqliteDialect.Provider; ConnectionString = SqliteFileDb;