servicestack

AJAX call against REST endpoint secured with Thinktecture's IdentityServer STS

我是研究僧i 提交于 2019-12-04 11:26:15
I'm having some dramas making a call against a ServiceStack REST service which I've secured with an out of the box IdentityServer STS. I'm making an AJAX call against the REST endpoint, and I'm not sure how one might setup a logon procedure to get a security token to pass. The REST endpoint is on a different domain than the website making the call. The info that I've found so far all seems to revolve around the procedure where the client makes a call to the secured resource gets a 302 redirect to the identityserver logon page, then after successful authentication gets a 302 redirect to either

How to use SSL with HttpListener with an mkbundle'd Mono app

笑着哭i 提交于 2019-12-04 11:22:22
I have a .NET application built with Mono, that I've bundled into a native (Linux) executable using mkbundle . This is so that end users don't need to mess around and install Mono themselves. The application uses ServiceStack, which under the hood uses HttpListener . I need the web services to be exposed over an SSL-enabled HTTP endpoint. Normally, you would run something like httpcfg -add -port 1234 -p12 MyCert.pfx -pwd "MyPass" during configuration (all this really does is copy the certificate to a specific path), and HttpListener would automatically bind the certificate to the port. So

Is it possible to auto generate nice documentation for REST API created by ServiceStack?

孤街醉人 提交于 2019-12-04 10:53:52
There are existing tools for auto generating API documentation - most of the weren't designed for REST services. For all of you who have created REST services using ServiceStack - how did you write the docs ? Manual / semi-auto / fully auto-gen ? I'm even considering auto gen a customized WADL and connecting it to something like apigee Console To Go (oh and RESTafaries- please spare the 'REST api should be auto discoverable and self-explained' mantra...I really want nice looking docs for my users). Documenting an API through XHTML might provide better results than formatting DTO's. Look at

Create table with custom name dynamically and insert with custom table name

自闭症网瘾萝莉.ら 提交于 2019-12-04 10:07:26
I want to create the table with custom name but I cannot find the sample code. I notice the only way to create table is by generic type like db.CreateTable(). May I know if there is a way to create the table name dynamically instead of using Alias? The reason is because sometime we want to store the same object type into different tables like 2015_january_activity, 2015_february_activity. Apart from this, the db.Insert also very limited to object type. Is there anyway to insert by passing in the table name? I think these features are very important as it exists in NoSQL solution for long and

ServiceStack Authentication with Existing Database

陌路散爱 提交于 2019-12-04 08:37:58
I've been looking at ServiceStack and I'm trying to understand how to use BasicAuthentication on a service with an existing database. I would like to generate a public key (username) and secret key (password) and put that in an existing user record. The user would then pass that to the ServiceStack endpoint along with their request. What do I need to implement in the ServiceStack stack to get this working? I have looked at both IUserAuthRepository and CredentialsAuthProvider base class and it looks like I should just implement IUserAuthRepository on top of my existing database tables. I am

ServiceStack: Adding routes dynamically

你。 提交于 2019-12-04 08:27:40
I have not tried this yet, but I would like each module (Silverlight) to register its own routes, rather then adding it in application start. Can routes be added to AppHost after application start, or do they all have to be immediatelly registered during Configure step? I am thinking to scan all assemblies at the startup and provide AppHost with all assemblies that implement service stack services, but let each module add its own routes (have not figured out yet exact mechanism. Before I go down this route, need to know if it is possible to add routes after the Configure step. All

How to write a ServiceStack plugin which needs both request and response Dtos

老子叫甜甜 提交于 2019-12-04 07:53:47
I need to service localized data. All response Dtos which are localized share the same properties. I.e. I defined an interface ( ILocalizedDto ) to mark those Dtos. On the request side, there is a ILocalizedRequest for requests which demand localization. Using IPlugin I already managed to implement the required feature. However I am quite sure that the implementation is not thread safe and additionally I don't know if I could use IHttpRequest.GetHashCode() as identifier for one request/response cycle. What would be the correct way to implement a ServiceStack plugin which makes use of both

How to configure ServiceStack.Text to use EnumMember when deserializing?

孤街浪徒 提交于 2019-12-04 05:29:04
问题 I am using ServiceStack.Text to deserialize json received in rest api calls to objects C#. The model classes I use have defined the string representation using EnumMember attributes. The problem is that ServiceStack.Text does not seem to use those values. ServiceStack.Text documentation has a section called Custom enum serialization that discusses EnumMember attribute, but it talks only about serialization with no mention of deserialization. It is possible to configure ServiceStack.Text to

ServiceStack - how to disable default exception logging

旧时模样 提交于 2019-12-04 05:21:23
问题 In line with the ServiceStack documentation, we have a global service exception handler. The docs say that this handler should log the exception then call DtoUtils.HandleException , like this: private object LogServiceException(object request, Exception exception) { var message = string.Format("Here we make a custom message..."); _logger.Error(message, exception); return DtoUtils.HandleException(this, request, exception); } This results in the error being logged twice, since DTOUtils

ServiceStack: how to deal with errors?

不想你离开。 提交于 2019-12-04 04:39:18
I'm using ServiceStack with great results so far, except that dealing with errors is seemingly tricky. If something goes wrong during serialization of a message (because I forgot to add a default constructor to the message for example) all the client gets back is a message that the server had an internal error and a status code of 500. Adding a listener to the HttpApplication.Error event in the Global.asax doesn't work as it never gets hit. Neither does Application_Error . Not only is this insufficient for end user scenarios, it makes debugging these errors very cumbersome as the only way to