nancy

How to get a response from the Nancy Negotiator?

不羁的心 提交于 2019-11-29 10:32:36
问题 I have a NancyContext and I need to get a Response with a body based on the correct content negotiator for the request. I think I can use Nancy's Negotiator class to add a model, set the status, and other things. But then, I need to return a subtype of Response . So, what can I use to build the response using the Negotiator ? Here's my method: public Response ConvertToHttpResponse(Exception exception, NancyContext context) { var negotiator = new Negotiator(context) .WithStatusCode

Self-host of ASP.NET MVC application

时间秒杀一切 提交于 2019-11-28 17:56:31
I have a full-working ASP.NET MVC application (consisting of 5 assemblies, .NET 4.5.1, ASP.NET MVC 5.2.2) which runs fine in Visual Studio (which uses IISExpress). I would now like to have a console application which takes the MVC application and hosts it (self hosting). I tried with Microsoft.Owin.Host.HttpListener and Nancy.Owin but while I get 404 pages my configurations lacks the mapping to my MVC-app. I got public class Startup { public void Configuration(IAppBuilder app) { app.UseNancy(); } } and static void Main(string[] args) { StartOptions so = new StartOptions("http://localhost:9000/

NancyFx and Windows Authentication

让人想犯罪 __ 提交于 2019-11-28 16:03:25
问题 I want to use NancyFx for an intranet web app. All the documentation and forums only mention Forms and Basic authentication. Anyone successfully use Nancy with Windows Authentication? There's also something called Nancy.Authentication.Stateless but I can't see what that does (looks like it's for use in Apis). 回答1: I used this in an internal project recently - I don't really like it, and it ties you to asp.net hosting, but it did the job: namespace Blah.App.Security { using System; using

EntityFramework DbContext lifecycle + Postgres: “An operation is already in progress.”

假装没事ソ 提交于 2019-11-28 09:31:41
问题 I have been messing with the following for a few days now. I have a Nancy app running on Mono, with EntityFramework with Repository pattern and UnitOfWork, and Postgres. Nancy uses TinyIoC as it's IoC container. I have a web app that queues requests on the front-end so the back-end gets hit one request at a time. This all works fine. However, the trouble starts when I run an iOS app that connects to the same back-end and does not queue requests to the backend, firing request sometimes almost

Registering dependencies within TinyIOC for use in NancyFX

一笑奈何 提交于 2019-11-28 00:22:32
问题 I have another newbie question regarding registering additional dependencies within TinyIoc for use within NancyFX. I am continuing to get the following exceptions when running the application... Unable to resolve type: AdvancedSearchService.Interfaces.IResponseFactory Exception Details: TinyIoC.TinyIoCResolutionException: Unable to resolve type: AdvancedSearchService.Interfaces.IResponseFactory Source Error: Line 25: var container = TinyIoCContainer.Current; Line 26: Line 27:

Self-host of ASP.NET MVC application

廉价感情. 提交于 2019-11-27 10:55:38
问题 I have a full-working ASP.NET MVC application (consisting of 5 assemblies, .NET 4.5.1, ASP.NET MVC 5.2.2) which runs fine in Visual Studio (which uses IISExpress). I would now like to have a console application which takes the MVC application and hosts it (self hosting). I tried with Microsoft.Owin.Host.HttpListener and Nancy.Owin but while I get 404 pages my configurations lacks the mapping to my MVC-app. I got public class Startup { public void Configuration(IAppBuilder app) { app.UseNancy(

Unable to map an HttpHandler to a “path/*” wildcard mapping

允我心安 提交于 2019-11-27 01:48:00
问题 So I've been trying to map an http module to a sub-path of an MVC3 site. It should be pretty simple as I understand it, but it has not been working. The module is setup like so: <handlers> <add name="Nancy" path="api/*" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" allowPathInfo="true" /> </handlers> A matching section is also there for iis6 so I can run it under webdev.webserver. However testing both deploying to my local iis7 (under Win7) and with webdev.webserver, only /api

Self hosted OWIN and urlacl

左心房为你撑大大i 提交于 2019-11-27 01:42:58
I've created a self hosted Nancy/SignalR application self-hosted in OWIN using Microsoft.Owin.Host.HttpListener and Microsoft.Owin.Hosting Things work perfectly fine locally but as soon as I try to use anything but localhost to access the app I get a HTTP Error 503. The service is unavailable error. I can't even access the app using 127.0.0.1 or the machine name. I've tried adding the port to urlacl using http add urlacl http://*:8989/ user=EVERYONE but doesn't seem to do anything. here are the OWIN start options that I've tried, var options = new StartOptions { Url = "127.0.0.1", App =