c# - IIS 10.0 详细错误 - 404.0 - 未找到 - Windows 10 更新后

标签 c# asp.net iis asp.net-web-api visual-studio-2015

我很困惑,在 Windows 10 更新 之后,我的 Web Api 应用程序IIS 发生了什么。

像下面这样的一些 Controller 工作得很好:

[RoutePrefix("api/test")]
public class TestController : ApiController {
    [HttpPost]
    [Route("test01/{str}")]
    public IHttpActionResult Test01([FromUri]string str) {
        return Ok(str);
    }
}

但是像这样的其他一些方法不起作用并返回 IIS 10.0 详细错误 - 404.0 - 未找到:

[RoutePrefix("api/companies")]
public class CompaniesController : ApiController {
    [HttpPost]
    [Route("test/{str}")]
    public IHttpActionResult PostCompany([FromUri]string str) {
        return Ok(str);
    }
}

注意:我已经删除了 Windows 和 Visual Studio 的更新。甚至重新安装 Visual Studio 并从 windows features 重新启动 IIS,但没有进行任何更改。

现在我正在考虑重新安装操作系统。你有什么建议?

更多信息:我已经在我同事的机器上对其进行了测试,它的所有操作都按预期工作。

最佳答案

在尝试了很多与操作系统visual studioiis 相关的解决方案后,我发现真正的问题是引用另一个引起的具有相同 Controller 名称的 web-api 项目。

我不确定这是否是错误,不过我没想到会有这样的行为。

关于c# - IIS 10.0 详细错误 - 404.0 - 未找到 - Windows 10 更新后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47303740/

相关文章:

iis - 使用 Web.Config 将目录重定向到子域

c# - 将网站从 http 重定向到 https

c# - 在 C# 中使用 NumericComparer 代码,为什么我的 List.Sort() 会出现转换错误?

asp.net - session 状态提供程序如何在 Application_Start 中设置

c# - 由 UpdatePanel 内的 GridView 内的 LinkBut​​ton 触发的完整回发

c# - 如何获取下载文件的完整路径

asp.net-mvc - 当所有看起来都通过 SSL 时混合内容消息?

c# - 在 Windows 8 桌面应用程序中获取位置

c# - 如何配置 UseSqlServer?

c# - 如何获得符合条件的通用列表元素的平均值?