nancy

SignalR plus NancyFX : A simple but well worked example

陌路散爱 提交于 2019-12-18 11:55:23
问题 There are a few examples of NancyFX being integrated with SignalR, for example Signalr & Nancyfx integration Since I am just starting out I want a simple, well worked canonical example that I can work from. A nancy version of the chat example from Microsoft would do fine. Tutorial: Getting Started with SignalR (C#) Thanks 回答1: I am going to answer my own question. I put together a little canonical-chat example based on the Microsoft walkthrough. You can get it from GitHub: Nancy + SignalR -

Can't get ASP.NET Web API 2 Help pages working when using Owin

你离开我真会死。 提交于 2019-12-17 22:20:02
问题 I've installed the correct package for Web Api 2 Install-Package Microsoft.AspNet.WebApi.HelpPage -Pre But the help area is not being mapped and is returning 404 (Web Api working fine). I'm using Microsoft.Owin.Host.SystemWeb as the host. Below is my Startup code. public class Startup { public void Configuration(IAppBuilder app) { //Required for MVC areas new HttpConfiguration() doesn't work with MVC var config = GlobalConfiguration.Configuration; AreaRegistration.RegisterAllAreas();

Remote access to a Nancy Self Host

余生长醉 提交于 2019-12-17 18:28:40
问题 I am creating a Nancy Module that will eventually be hosted inside of a Windows Service. I am currently running it inside of a WPF test application. To start the Nancy hosting, I am using Nancy.Hosting.Self and calling: nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8080")); nancyHost.Start(); On my local machine I am able to go to a web browser and access my module by entering http://localhost:8080 into the address bar. If I go to another machine I am not able to

Self hosted OWIN and urlacl

人走茶凉 提交于 2019-12-17 07:26:11
问题 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

503 Error when using NancyFx with Owin

萝らか妹 提交于 2019-12-14 03:53:48
问题 I'm trying to use NancyFx in combination with SignalR. In order to host both, I'm using Microsoft Owin. But unfortunately I always get an 503 (Service unavailable), when trying to access the REST-API via PostMen (REST-Api Client extension for chromium browsers). So I extracted the main ingredients to a more simple program, that allows me to switch between Nancy Selfhost and Owin. When using Nancy SelfHost, everything works fine, but using Owin I still got a 503 error. internal class Program {

Where do I find object to compare in CompareValidatorAdapter for Nancy?

谁都会走 提交于 2019-12-13 18:07:08
问题 I want to build a CompareValidatorAdapter for Nancy. Can any one give me some pointers as to where I can get the value to be compared? public override IEnumerable<ModelValidationRule> GetRules(ValidationAttribute attribute, PropertyDescriptor descriptor) { var ca = (CompareAttribute)attribute; yield return new ComparisonValidationRule(attribute.FormatErrorMessage, new[] { descriptor.Name }, ComparisonOperator.Equal, <WHERE DO I GET THIS VALUE?>); } Should I use some sort of reflection

Redirect to ReturnUrl after successful cookie authentication in Owin, Katana & Nancy

独自空忆成欢 提交于 2019-12-13 11:43:52
问题 I am using Owin, Katana and Nancy to host a simple site with an authentication required section. Note I am also using nuget package - Nancy.MSOwinSecurity app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.AuthenticationType, LoginPath = new PathString("/Login"), }); app.UseNancy(); Here is my module code public class LoginModule : NancyModule { public LoginModule() { Post["login"] = p => { var name = Request.Form.name; var auth = Context

“The name 'Html' does not exist in the current context” exception

放肆的年华 提交于 2019-12-13 05:19:43
问题 I'm rendering Spark templates in a console application and I'm trying to use RenderPartial like so: ${Html.RenderPartial("_mypartial.spark", myData)} but I'm getting this error when compiling the view: The name 'Html' does not exist in the current context In the Shared\_global.spark I have added this imports: <use namespace="System" /> <use namespace="System.Web.Mvc" /> <use namespace="System.Web.Mvc.Html" /> <use namespace="System.Collections.Generic" /> <use namespace="System.Linq" />

Request.Url has wrong port information

ぐ巨炮叔叔 提交于 2019-12-13 00:06:34
问题 My web application is using Nancy, and is hosted in Asp.Net, in Azure. In development, I am using IIS Express, and Azure's Compute Emulator. In production, the homepage opens in http://mydomain/test Debugging on my machine, the homepage opens in http://127.0.0.1:81/test But, in my NancyModule, I'm getting: Request.Url == http://127.0.0.1:82/test Why 82? Maybe it has something to do with IIS Express showing its site on http://127.255.0.0:82/ ? 回答1: 82 is the port that IIS is serving the app

Nancy maximum JSON length exception when Binding

£可爱£侵袭症+ 提交于 2019-12-12 18:23:31
问题 I have simple Nancy self hosting C# project which deserializes data in NancyModule like this: Post["/build"] = (something) => { var data = this.Bind<Brick>(); } I am getting "Maximum JSON input length has been exceeded." when Request.Body.Length is close to 2MB. I would like to send tens of megabytes of data in the future and 2MB is just too low. Can I remove this limit? 回答1: You can override the MaxJsonLength and the MaxRecursions. Basically I did a custom bootstrapper something like this: