NancyFx与Owin一起使用时出现503错误 [英] 503 Error when using NancyFx with Owin
问题描述
我正在尝试将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 = "http://localhost:7084";
UseSelfHost(host);
} else {
var host = "http://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 : http://wks-user:7084/
Benutzer: DOMAIN\user
Abh▒ren: Yes
Delegieren: No
SDDL: D:(A;;GX;;;XXX)
Reservierte URL : http://+:7084/
Benutzer: DOMAIN\user
Abh▒ren: Yes
Delegieren: No
SDDL: D:(A;;GX;;;XXX)
通过
netsh http delete urlacl http://wks-user:7084/
一切正常.
这篇关于NancyFx与Owin一起使用时出现503错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!