简体   繁体   English

IIS 7.5中的Web API路由

[英]Web API routing in IIS 7.5

I am attempting to publish our web api to IIS 7.5. 我试图将我们的Web API发布到IIS 7.5。 I have it deployed as an application "api". 我已将其部署为应用程序“ api”。 I am able to successfully deploy the application and it runs. 我能够成功部署该应用程序并运行。 I can access it at /api/api/ . 我可以在/ api / api /上访问它 I believe this was due to having "api" in the routing config of the api controllers as well as having it hosted in the "api" application in IIS. 我认为这是由于api控制器的路由配置中包含“ api”以及将其托管在IIS中的“ api”应用程序中。 I have removed the "api" portion of the route path in web api and it works correctly if I launch it from visual studio. 我已经从Web api中删除了路由路径的“ api”部分,如果我从Visual Studio中启动它,它将可以正常工作。 I would like to access it from /api instead of /api/api but IIS doesn't recognize this change . 我想从/ api而不是/ api / api访问它,但是IIS无法识别此更改 What could be causing this in IIS? 是什么原因导致IIS中出现这种情况? I am fairly new to IIS and I have googled around but I have not found anything useful. 我是IIS的新手,但我在google周围搜索,但没有发现任何有用的信息。

TL;DR I updated routes in my web api application but IIS is not recognizing those changes.How can I force IIS to update? TL; DR我在Web api应用程序中更新了路由,但是IIS无法识别这些更改。如何强制IIS更新?

After playing with this for some time I found that the problem was that I pointing the physical directory of IIS to the deployment package from VS and because I was building the project directly on the machine. 在玩了一段时间后,我发现问题是我将IIS的物理目录从VS指向了部署包,因为我是直接在机器上构建项目的。 This caused VS to quietly fail when it couldn't update the files because they were locked by IIS. 由于文件被IIS锁定,导致无法更新文件时,这导致VS悄然失败。 After deploying to a new path and then replacing the contents of the application the new routing works as expected. 部署到新路径后,然后替换应用程序的内容,新路由将按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM