servicestack

Is there a way to host Razor pages in console application using ServiceTask?

爱⌒轻易说出口 提交于 2019-12-01 00:38:00
I'm trying to make a console application to expose JSON services. In addition I'd like to host html and js pages to use them. I put the *.md (even *.htm) files into Views folder, but I can't reach them. If I add a route ".Add("/Test")" (where MyMarkdownView : MarkdownViewBase), i even get a "KeyNotFoundException The given key was not present in the dictionary." exception. Is it generally possible, or I should make my own service (similar to https://github.com/jimschubert/blogs/blob/master/2012-07-15/RazorExample/Main.cs ) to host them? You might be interested in the Razor Rockstars Console

Migrated web service to .NET Core 2.0 and returning json

邮差的信 提交于 2019-12-01 00:23:21
I have migrated my web service to .NET Core 2.0, it works fine but I have problem with getting response as json string. Method on api: [HttpGet] [ProducesResponseType(typeof(string), 200)] [ProducesResponseType(typeof(EntityNotFoundErrorResult), 404)] public async Task<IActionResult> GetCurrenciesAsync() { var result = await service.GetByTypeAsync(ObjectType.Currency.ToString()); return Ok(result); } that is returning proper json as result : "{\"elements\": [{\"Id\": \"1\", \"Symbol\": \"PLN\"},{\"Id\": \"2\", \"Symbol\": \"SIT\"}]}" Then on client I'm using service stack to get my currencies

Timeout using ServiceStack.Client

你。 提交于 2019-12-01 00:04:30
I have been using service stack via AJAX calls for some time without issue, but have recently created a quick winforms app which utilizes the service stack client (specifically JsonServiceClient). However - I have hit a problem whereby I consistently get a timeout on a call which works successfully on the the first TWO attempts. It looks like either the service stack client is holding on to some resource, or I am using the client in the wrong way. It only occurs when running against a remote service (works every time on a local machine). Here is my code, and the exception: var url = "http:/

ServiceStack: Serving Static files from a directory when present?

☆樱花仙子☆ 提交于 2019-11-30 23:58:11
I am in the process of converting my stand-alone home grown web server to use ServiceStack for serving all pages and resources. I see from this question Serving a static file with servicestack that it is easy to serve a single static file with Service Stack. In my home grown implementation, after checking to see if a URL matches any particular handler (equivalent to ServiceStack routes), the default handler then checks for a static file in its HttpData directory to serve matching the URL. If that file does not exist, it then generates a 404 error. What is the best pattern to use with

How to compose request for REST web method in fiddler

╄→尐↘猪︶ㄣ 提交于 2019-11-30 22:05:49
问题 I am able to call web serivce but name property is not binding. Fiddler request POST http://localhost:50399/api/custservice/ HTTP/1.1 User-Agent: Fiddler Host: localhost: 50399 Content-Length: 28 { "request": { "name":"test"}} POST Webmethod public string Any(CustomerRequest request) { //return details } CustomerRequest.cs public class CustomerRequest { public string name {get;set;} } 回答1: First of all you need to add Content-Type 'application/json' to the request: POST http://localhost:50399

Returning Raw Json in ElasticSearch NEST query

落爺英雄遲暮 提交于 2019-11-30 20:21:07
I'm doing a small research about a client for elastic search in .net and I found that NEST is one of the most supported solutions for this matter. I was looking at Nest's docummentation and I couldn´t find a way to output a raw json from a query and avoid the serialization into an object, because I'm using angularJs in the front end I don´t want to overload the process of sending the information to the client with some unnecessary steps. ......and also I'd like to know how can I overrdide the serialization process? I found that NEST uses Json.NET which I would like to change for the

Hypermedia links with Servicestack new API

核能气质少年 提交于 2019-11-30 20:16:08
I am evaluating how to add hypermedia links to DTO responses. Although there is no standard, add List to the response DTOs seems to be the suggested approach . Do you know of any example or reference of implementation using ServiceStack framework? Adding List is ok for me, but my doubts are about where to put the logic of the following links (Within the service or a specialized class that holds the state machine?) and where to resolve the routes (A filter?) Thanks. [Update] From ServiceStack version v3.9.62 it is posible to access Routes configuration via EndpointHost.Config.Metadata.Routes

POST to ServiceStack Service and retrieve Location Header

妖精的绣舞 提交于 2019-11-30 19:47:55
I am trying to POST to my ServiceStack service and retrieve the Location header from the response of my CREATED entity. I am not sure whether using IReturn is valid but I am not sure how to access the Response headers from my client. Can someone help me understand how to interact with the HttpResult properly? There is a test case at the bottom of the code to demonstrate what I want to do. Here's the codz: public class ServiceStackSpike { public class AppHost : AppHostHttpListenerBase { public AppHost() : base("TODOs Tests", typeof(Todo).Assembly) { } public override void Configure(Container

ServiceStack with IIS 7.5

☆樱花仙子☆ 提交于 2019-11-30 19:24:34
I installed Clean Windows Web Server 2008 R2 64-bit with IIS 7.5. I created .NET v4.0 application pool and Web Site in this pool, where I deployed my application with ServiceStack services. I got this error message in web browser when I opened servicestack page.: HTTP Error 500.21 - Internal Server Error Handler "ServiceStack.Factory" has a bad module "ManagedPipelineHandler" in its module list. My application is working in Visual studio hosted IIS server. Can be problem with IIS 7.5 instalation and servicestack or it is some asp.net issue? 1) Ensure the following is in the web.config <!--

Timeout using ServiceStack.Client

十年热恋 提交于 2019-11-30 18:06:31
问题 I have been using service stack via AJAX calls for some time without issue, but have recently created a quick winforms app which utilizes the service stack client (specifically JsonServiceClient). However - I have hit a problem whereby I consistently get a timeout on a call which works successfully on the the first TWO attempts. It looks like either the service stack client is holding on to some resource, or I am using the client in the wrong way. It only occurs when running against a remote