servicestack

How to use Servicestack PostFileWithRequest

≯℡__Kan透↙ 提交于 2019-12-11 03:26:05
问题 I am trying to figure out how to post a file to my webservice using servicestack. I have the following code in my client Dim client As JsonServiceClient = New JsonServiceClient(api) Dim rootpath As String = Server.MapPath(("~/" + "temp")) Dim filename As String = (Guid.NewGuid.ToString.Substring(0, 7) + FileUpload1.FileName) rootpath = (rootpath + ("/" + filename)) FileUpload1.SaveAs(rootpath) Dim fileToUpload = New FileInfo(rootpath) Dim document As AddIDVerification = New AddIDVerification

ServiceStack OpenId AuthProviders on Mono

▼魔方 西西 提交于 2019-12-11 03:00:45
问题 The problem is that OpenId Auth providers aren't working under Ubuntu 12.04 with nginx/1.1.19, Mono JIT compiler version 3.1.1, fastcgi-mono-server4.exe 2.10.0.0 The ServiceStack references were all pulled via Nuget are at version 3.9.55.0, including ServiceStack.Authentication.OpenId which is attached to DotNetOpenAuth 4.3.0.0 The project is based on the ServiceStack Template CustomPath40 and all of the projects are built under .NET 4 with VS2012 on Win7x64. Every auth works perfectly fine

Can ServiceStack.Text deserialize JSON to a custom generic type?

天大地大妈咪最大 提交于 2019-12-11 02:39:37
问题 Example is the following, where T is some DTO that I expect to get 1...n back matching the resultCount. This loaded up fine using Jayrock JsonConvert, however is just returning a new JsonResult to me when trying to deserialize the same json text that worked in Jayrock. [Serializable] public class JsonResult<T> { public int resultCount = 0; public T[] results; } I thought this might be an issue that I asked about at ServiceStack.Text.JsonSerializer.DeserializeFromString<T>() fails to

How to remove the stacktrace from the standard ServiceStack error respose

扶醉桌前 提交于 2019-12-11 02:37:34
问题 I'm just getting started with ServiceStack, and I'd like to find out if it's possible to remove the stacktrace from the standard error response. I have tried shutting off debugmode without any luck: public override void Configure(Funq.Container container) { SetConfig(new EndpointHostConfig { DebugMode = false, }); } Thanks a bunch! 回答1: By default the configuration below only removes the StackTrace from being externally visible in your Web Service's response: SetConfig(new EndpointHostConfig

ServiceStack - [Reference] or [Ignore]?

﹥>﹥吖頭↗ 提交于 2019-12-11 02:28:50
问题 We have a DTO - Employee - with many (> 20) related DTOs and DTO collections. For "size of returned JSON" reasons, we have marked those relationships as [Ignore]. It is then up to the client to populate any related DTOs that they would like using other REST calls. We have tried a couple of things to satisfy clients' desire to have some related Employee info but not all: We created a new DTO - EmployeeLite - which has the most-requested fields defined with "RelatedTableNameRelatedFieldName"

Unit testing servicestack services with custom serialization / deserialization

青春壹個敷衍的年華 提交于 2019-12-11 02:23:48
问题 I have a problem testing webservice that has its own de/serialization mechanism provided. My sample Task class that is being used by TaskService : public class Task { public string TaskName { get; set; } public string AuxData { get; set; } public static void RegisterCustomSerialization(IAppHost appHost) { appHost.ContentTypeFilters.Register("application/xml", SerializeTaskToStream, DeserializeTaskFromStream); } public static void SerializeTaskToStream(IRequestContext requestContext, object

Getting servicestack working on monodroid

ぐ巨炮叔叔 提交于 2019-12-11 02:22:40
问题 I'm trying to reference the servicestack dlls in a new monodroid project and I'm getting build errors. I grabbed the dlls from here: https://github.com/ServiceStack/ServiceStack/tree/master/release/latest/MonoDroid And I'm getting the error /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/Microsoft.Common.targets: Warning: Found a conflict between : 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' and 'mscorlib, Version=4.0.0.0, Culture=neutral,

OPTIONS Verb for Routes with custom CORS headers

假装没事ソ 提交于 2019-12-11 02:22:29
问题 Lets say I have a route like this: [Route("/users/{Id}", "DELETE")] public class DeleteUser { public Guid Id { get; set; } } If I am using CORS with a custom header, an OPTIONS preflight request will be sent out. This will happen on all requests. With the above route, the route will fire, but the OPTIONS will 404 and the ajax error handler will fire. I could modify the route to be [Route("/users/{Id}", "DELETE OPTIONS")] but I would need to do this on every route I have . Is there a way to

How to set up Redis in custom namespace as cache and MQ on ServiceStack web application using Structuremap

房东的猫 提交于 2019-12-11 02:12:19
问题 I want to set up my application to use Redis as Cache for sessions etc as well as run my Message Queues. My application is a ASP.net MVC website along with ServiceStack based Json service provider. What is the optimal way to configure? I want to be able to pass an IMessageQueueClient into my service classes and controllers so that I can add tasks to the queue. I'm getting somewhat lost over what scope to make what. My code is as follows: //Redis Client Manager var pooledClientManager = new

ServiceStack: No /swagger-ui/index.html

橙三吉。 提交于 2019-12-11 02:07:30
问题 I am using ServiceStack for my custom service, in stand alone mode without IIS. I would like to add documentation for my services beyond what /metadata does. I thought to try the Swagger plug in. I have added the plug-in command to my Config public override void Configure(Funq.Container container) { SetConfig(new EndpointHostConfig() { DefaultRedirectPath = "index.html", DebugMode = true, WriteErrorsToResponse = true, CustomHttpHandlers = { { HttpStatusCode.Unauthorized, new