NancyFx与Owin一起使用时出现503错误

编程入门 行业动态 更新时间:2024-10-26 17:36:23
本文介绍了NancyFx与Owin一起使用时出现503错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试将NancyFx与SignalR结合使用.为了同时托管这两个主机,我使用的是Microsoft Owin.但是,不幸的是,当我尝试通过PostMen(适用于Chrome浏览器的REST-Api客户端扩展)访问REST-API时,总是收到503(服务不可用).因此,我将主要成分提取到了一个更简单的程序中,该程序使我可以在Nancy Selfhost和Owin之间切换. 使用Nancy SelfHost时,一切正常,但是使用Owin,我仍然遇到503错误.

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 { private const bool _USE_SELF_HOST = false; private static void Main(string[] args) { if (_USE_SELF_HOST) { var host = "localhost:7084"; UseSelfHost(host); } else { var host = "localhost:7084"; UsingWebApp(host); } } private static void UseSelfHost(string host) { var webhost = new NancyHost(new Uri(host)); webhost.Start(); Console.ReadLine(); webhost.Stop(); } private static void UsingWebApp(string host) { var nancyHost = WebApp.Start<Startup>(host); Console.WriteLine($"Nancy started at {host}"); Console.ReadLine(); nancyHost.Dispose(); } } public class MainModule : NancyModule { public MainModule() { Get["/"] = x => "Hello world!"; } }

我检查了:

  • netsh http show urlacl-我可以打开此端口
  • Visual Studio以管理员权限运行,除此之外不需要.
推荐答案

我的一位同事在我的netsh配置中发现错误.我在同一个tcp端口上有两个urlacls:

A colleague of mine found an error in my netsh configuration. I had two urlacls for the same tcp port:

Reservierte URL : wks-user:7084/ Benutzer: DOMAIN\user Abh▒ren: Yes Delegieren: No SDDL: D:(A;;GX;;;XXX) Reservierte URL : +:7084/ Benutzer: DOMAIN\user Abh▒ren: Yes Delegieren: No SDDL: D:(A;;GX;;;XXX)

通过

netsh http delete urlacl wks-user:7084/

一切正常.

更多推荐

NancyFx与Owin一起使用时出现503错误

本文发布于:2023-11-11 16:52:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579022.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   NancyFx   Owin

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!