servicestack

how to post plain json data to service stack rest service

雨燕双飞 提交于 2019-12-24 15:58:46
问题 Below is the code I am using to post json data to a rest ful service var client = new JsonServiceClient(BaseUri); Todo d = new Todo(){Content = "Google",Order =1, Done = false }; var s = JsonSerializer.SerializeToString < Todo>(d); // client.Post<string>("/Todos/", "[{\"content\":\"YouTube\"}]"); // string payload= "[{\"id\":2,\"content\":\"abcdef\",\"order\":1,\"done\":false}]"; // string payload = @"{""todo"":{ {""content"":""abcdef"",""order"":1}} }"; client.Post<string>("/todos/", s); I

Unexpected behaviour with requered ordering position XML node on ServiceStack WS

谁说胖子不能爱 提交于 2019-12-24 13:52:10
问题 Now as I know ServiceStack uses .NET's Xml DataContractSerializer to serialize/deserialize XML, but with it we have some truble in case when our webservice API used not .NET framework. This problem very good described in this post if try short describe of problem: Requirement of strict sequence of nodes XML is very uncomfortable for some external no. NET system. Is it possible to use a different serialize or configure the ServiceStack used, so that he did not expect the elements in a rigidly

How to correctly implement IUserSessionSource - ServiceStack

依然范特西╮ 提交于 2019-12-24 13:46:24
问题 A new feature has been added to ServiceStack 5.0 that allows for refreshTokens without an IAuthRepository , see here I do not know of any documentation available for this new feature of ServiceStack 5.0, I have a Custom AuthProvider and I am not sure how to implement IUserSessionSource . Currently, my IUserSessionSource.GetUserSession implementation is not even called and I have cleared my Nuget cache and retrieved the latest 5.0 libs from ServiceStacks Nuget server. Here is my code: public

Servicestack accessing json

萝らか妹 提交于 2019-12-24 13:26:23
问题 My Servicestack service is beeing posted Json (by jquery). sendData = function(dataToSend) { var request; return request = $.ajax({ url: "/api/test", type: "post", data: JSON.stringify(dataToSend), dataType: "json", accept: "application/json", contentType: "application/json" }); The Json data is correctly deserialized if it corresponds to the root properties of my DTO (eg: userId:'foo' -> UserId=foo in the DTO). I want to access the raw json posted data before it gets deserialized for adding

How to get the session details in servicestack application from SQLServer using session id sent from mvc application?

廉价感情. 提交于 2019-12-24 12:24:21
问题 I have two applications deployed on different servers. 1) ASP.net MVC 4 web application with sessionState mode="SQLServer" for session management 2) Servicestack service application with sessionState mode="SQLServer" for session management ( yes i need session in service application ) both application share same database and tables for session management I am using following solution to have asp.net session in service stack application . Reconnecting to Servicestack session in an asp.net MVC4

ServiceStack and Auth0

瘦欲@ 提交于 2019-12-24 12:14:51
问题 I am looking to use Auth0 as the authentication provider for ServiceStack. There is a great sample application documented at Auth0 which applies & works well when working with ServiceStack and using ServiceStack.Host.MVC: https://auth0.com/docs/quickstart/webapp/servicestack/01-login. However, I am at a loss how to construct the authorization URL and redirect the user to that URL in a scenario where I am NOT using MVC & the AccountController to redirect the user. How can I construct the

Session not saved in ServiceStack

半城伤御伤魂 提交于 2019-12-24 11:27:53
问题 I want to use the session feature but without athentication. I already added Plugins.Add(new SessionFeature()) to AppHost.cs and I have the following code public class CustomService : Service { public CustomResponse Any(CustomRequest pRequest) { var CustomSession = base.Session.Get<CustomType>("MySession");//try to get the session if (CustomSession == null) { //create a new session CustomSession = new CustomType{MyId=1}; base.Session["MySession"] = CustomSession; //base.Session.Set("MySession

Vue.js router history mode with ServiceStack routing fallback and Api prefix

℡╲_俬逩灬. 提交于 2019-12-24 09:23:51
问题 Every client side route starts with a hash. How can I enable History Mode in Vue Router without disturbing the api routing? Also I would prefer not to have to start my routes with "/api". Client side routing didnt work with Config.HandlerFactoryPath set to "api". Is there a way to achieve it? APPHOST public class AppHost : AppHostBase { private BackendSettings _settings; private IHostingEnvironment _environment; public AppHost(BackendSettings settings, IHostingEnvironment environment) : base(

Servicestack object parameter not getting passed to service with Swagger-UI

烂漫一生 提交于 2019-12-24 09:08:10
问题 My service model: [Route("/customer/{CustomerId}/creditcardtoken/{CanLookup}", "POST")] public class CreditCardToken : IReturn<CreditCardTokenResponse> { [ApiMember(ParameterType = "path", DataType = "string", IsRequired = true, Verb = "POST")] public string CustomerId { get; set; } [ApiMember(ParameterType = "path", DataType = "boolean", IsRequired = true, Verb = "POST")] public bool CanLookup { get; set; } [ApiMember(ParameterType = "body", DataType = "CreditCard", IsRequired = true, Verb =

How to get DNS name from REST service which is consumed by startuptask of Azure webrole

筅森魡賤 提交于 2019-12-24 07:55:42
问题 I have confirmed with that it's not possible to get DNS Name and environment details (staging vs production) without certificate & management API. However let's consider my case in that my startuptask(exe) consume REST service to post some data so in that REST service can i do some trick to get DNS name? I have tried with following HttpContext.Current.Request.UserHostName however it is same as HttpContext.Current.Request.UserHostAddress Please give me suggestion if anyone have you did this