http.sys即使在与该服务的基本地址不匹配的地址上也返回404

时间:2018-08-28 15:12:32

标签: asp.net-web-api http-status-code-404 http.sys

我正在使用asp.net核心和HttpSys在Windows 2016服务器上运行多个微服务。

我遇到的问题是,即使服务未定义基地址或前缀,服务器仍会返回404。

例如: 微型服务正在http://*/info/api/1.0上作为基址侦听

WebHost.CreateDefaultBuilder(args)
            .UseHttpSys(options =>
            {
                options.Authentication.Schemes = AuthenticationSchemes.Negotiate;
                options.Authentication.AllowAnonymous = false;
            })
            .UseStartup<Startup>()
            .UseContentRoot(contentRootPath)

            .UseUrls("http://*/info/api/1.0")
            .ConfigureLogging((hostingContext, logging) =>
            {
                // logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
                logging.ClearProviders();
                logging.AddConsole();
            })
            .UseNLog()
            .Build();

此服务启动后,对http://servername/missingservice/api/1.0/test之类地址的请求将返回404

有没有一种配置httpsys的方法,可以使两者之间有所不同

  1. 没有服务在地址路径上监听
  2. 在特定服务中找不到资源

感谢您的反馈和帮助

0 个答案:

没有答案