servicestack

Redis unable to connect in busy load

最后都变了- 提交于 2019-12-24 00:53:14
问题 I get this error. What is the work around ? Could not connect to redis Instance at 127.0.0.1:6379 >> Stack trace : at ServiceStack.Redis.RedisNativeClient.Connect() at ServiceStack.Redis.RedisNativeClient.AssertConnectedSocket() at ServiceStack.Redis.RedisNativeClient.SendCommand(Byte[][] cmdWithBinaryArgs) at ServiceStack.Redis.RedisNative Client.SendExpectLong(Byte[][] cmdWithBinaryArgs) at ServiceStack.Redis.RedisClientList.GetEnumerator() a t Common.Tools.RedisDBHelper.checkListInt(String

ServiceStack Ormlite and RowVersion support

岁酱吖の 提交于 2019-12-24 00:43:27
问题 What is the easiest way to support sql server rowversion during update? I tried this: db.UpdateOnly(u, f => new { f.Name, f.Description, f.Modified, f.ModifiedBy }, f => f.Version == u.Version && f.Id == u.Id); but that fails miserably because it compares version as a Varchar(8000) , go figure. Not exactly the same but still a ServiceStack and OrmLite question: What is the best way to eager load related entity descriptions? I've seen this but noticed the Join changeset being checked in? This

ServiceStack - Upload files with stream and with Uri

我们两清 提交于 2019-12-24 00:39:13
问题 I have got the following DTOs: [Route("/images/{imageId}/upload", "PUT")] public class GetImageWithStream : IRequiresRequestStream { public Stream RequestStream { get; set; } public string imageId { get; set; } } ///images/{imageId}/upload?url={imageUrl} [Route("/images/{imageId}/upload", "PUT")] public class GetImageWithUri { public string imageId { get; set; } public string url { get; set; } } /images/1/upload -> this should routed to the first DTO /images/1/upload?url=something.jpg -> this

Disable Get Keyword in Servicestack Login

对着背影说爱祢 提交于 2019-12-24 00:38:40
问题 Currently in auth/login, you can use any Get. How do I restrict GET keyword for certain built in services. We had a pentest finding stating that auth/login should not be allowed via the Get keyword but only put or post. 回答1: If you're referring to HTTP GET requests, you can register a Global Request Filter to short-circuit Authenticate HTTP GET requests with: GlobalRequestFilters.Add((req, res, requestDto) => { if (requestDto is Authenticate auth && req.Verb == HttpMethods.Get) { res

ServiceStack: JsonServiceClient usage without IReturn in DTO

≯℡__Kan透↙ 提交于 2019-12-24 00:16:46
问题 What I would like to do is the following: var client = new JsonServiceClient(ServiceUrl); var request = new FooQuery {Id = 1}; IEnumerable<Project> response = client.Get(request); However, my FooQuery doesn't implement any IReturn, and I'd like it not to (it's in a library without ServiceStack references). Here's my service side: Library of business objects: public class ProjectQuery { public int Id { get; set; } } AppHost: Routes.Add<ProjectQuery>("/project", "GET"); Service: public object

Servicestack client compression fails with generic lists

梦想的初衷 提交于 2019-12-23 23:18:14
问题 This question is a follow-up to ServiceStack client compression Servicestack natively supports client gzip/deflate compression since v4.5.5 But when I use a DTO with a property that is a generic list, that will will always be null when it reaches the service. Example below is a modded Servicestack unit-test which reproduces the issue: using System.Collections.Generic; using System.Runtime.Serialization; using Funq; using NUnit.Framework; using ServiceStack; [TestFixture] public class

Testing plugins in ServiceStack

人盡茶涼 提交于 2019-12-23 22:48:42
问题 Im looking at the source code for unit testing in ServiceStackTestHostBase.cs - and got it running with my own project. How would i go around enabling my plugins when unit testing without actually starting a listener? For examples i would like to test that my web service validates correctly, so i add the following code to Configure in TestHostBase.cs. Plugins.Add(new ValidationFeature()); container.RegisterValidators(typeof(CustomerModelValidator).Assembly); But when calling base.send with a

IdentityServer3 with ServiceStack and MVC Client

大城市里の小女人 提交于 2019-12-23 22:22:07
问题 I'm new to IdentityServer3 and am just starting to get it set up. It seems to be going quite well and I've been working on the Hybrid flow for an MVC app similar to that shown in Kevin Dockx's Pluralsight course (http://www.pluralsight.com/courses/building-securing-restful-api-aspdotnet) when I tried to configure IdentityServer with MVC error is pops up- Microsoft.IdentityModel.Protocols.OpenIdConnectProtocolException: invalid_request ID Server: new Client { Enabled = true, ClientName = "MVC

Does ServiceStack support generics in end-to-end typed requests

喜欢而已 提交于 2019-12-23 21:35:19
问题 I was playin' around with ServiceStack and was wondering if it supported this scenario. I'm using generics in my request types so that many DTOs that inherit from a common interface will support the same basic methods [ like... GetById(int Id) ]. Using a request type specific to a single kind of DTO works, but breaks the generics nice-ness... var fetchedPerson = client.Get<PersonDto>(new PersonDtoGetById() { Id = person.Id }); Assert.That(person.Id, Is.EqualTo(fetchedPerson.Id)); //PASS

How to register separate instance of a class using Windsor Container

会有一股神秘感。 提交于 2019-12-23 20:16:38
问题 Not very familiar with Windsor Container, modifying code written by other person. We have code which initializes all objects in WindsorContainer which has PgDataAccess (own class) data type property public PgDataAccess da { get; set; } Code is the following: _windsorContainer.Register(Component.For<PgDataAccess>().UsingFactoryMethod(() => { var dataAccess = new PgDataAccess(); dataAccess.ConnectionString = connectionString; return dataAccess; })); According to some errors seems we had same