我正在尝试将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错误
发布评论