在 IIS 上发布 Web 服务 - Web API 2

Publish Web Service - Web API 2 on IIS

我想在 IIS 7 中发布使用 Web Api 2 MVC5(这是我第一次)创建的 Web 服务。关注 this tutorial, after doing "Publish..." in Visual Studio for my web service, this is my publish folder: Publish folder image

然后我尝试完全按照教程中的方式在 IIS Express 中添加网站,然后在浏览它时出现 HTTP 403 错误。

此外,我用 Fiddler 测试了一个 POST 方法,我得到了 404 HttpNotFound

更新: 此外,我一步一步地 this tutorial 当我尝试测试路由映射时,我得到 404 HttpNotFound.

我错过了什么? 在此先感谢您的帮助

首先检查服务器上是否安装了 .Net 4.5。请使用 aspnet_regiis -i 命令在 iis.Also 上安装 .Net4.5 服务器,确保您的网站中有条目配置

<system.webServer>

要求

还要验证您是否安装了 HTTP 平台处理程序版本 1.2。可以下载了here

发布

发布您的站点时,请务必指向 wwwroot 文件夹 (check this post)