【问题标题】:Why getting 404 error for the api's on remote server为什么远程服务器上的 api 出现 404 错误
【发布时间】:2017-07-06 14:00:40
【问题描述】:

我有一个 ASP.Net WebApi 项目。我已经在我的本地机器 IIS 上部署了它。

在我的本地机器上,api 运行良好。此后,我将这组文件从本地机器复制到远程机器。

但是在从远程机器访问 API 时,我收到所有 api 的 404 错误。

我交叉检查了机器上的 IIS 配置。它们都是一样的。

本地 IIS

远程 IIS

http://localmachine/api/user/customer - 在本地运行良好。

http://remotemachine/api/user/customer - 远程 Http 404 错误。

非常感谢任何帮助/建议。
谢谢。

【问题讨论】:

  • 首先只浏览远程机器以检查它是否可以访问,如http://remotemachine
  • @Mairaj,默认 index.html 加载正常
  • OK 加载 api 主页。即没有controller/action
  • @Mairaj 对不起!!我没找到你
  • http://remotemachine/api

标签: c# iis asp.net-web-api deployment iis-7


【解决方案1】:

尝试在模块部分输入您的webconfig...

 <modules runAllManagedModulesForAllRequests="true"> 
<remove name="WebDAVModule"/> 
<remove name="FormsAuthentication"/>
</modules> 

【讨论】:

    猜你喜欢
    • 2023-01-15
    • 2017-09-26
    • 2016-11-13
    • 2018-09-16
    • 2013-05-23
    • 1970-01-01
    • 2011-03-18
    • 2023-04-01
    • 1970-01-01
    相关资源
    最近更新 更多