简体   繁体   English

尝试从URL调用IIS7上的MVC控制器

[英]Trying to call an MVC controller on IIS7 from URL

I deployed my asp.net mvc2 .net4 web application at a win2k8 32bit server with iis7. 我在带有iis7的win2k8 32位服务器上部署了asp.net mvc2 .net4 Web应用程序。 Doing exactly the same as I have done in the past on 64bit servers that were a bit more up to date patch-wise. 与过去在64位服务器上进行的更新完全相同,这是最新的补丁方式。 However it does not seem to be calling the controllers correctly. 但是,它似乎无法正确调用控制器。 When I call the following controller; 当我调用以下控制器时;

http://localhost/getPlaces?placeID=3498 I get a 404 not found error. http:// localhost / getPlaces?placeID = 3498我收到404未找到错误。

I used process monitor to monitor what was going on. 我使用过程监视器来监视正在发生的事情。 What that picks up is; 得到的是;

CreateFile c:\\inetpub\\wwwroot\\getPlaces\\web.config CreateFile c:\\ inetpub \\ wwwroot \\ getPlaces \\ web.config

CreateFile c:\\inetpub\\wwwroot\\GETPLACES CreateFile c:\\ inetpub \\ wwwroot \\ GETPLACES

And nothing else. 没别的。 To me that seems very strange. 在我看来,这很奇怪。

The web application is located in the wwwroot directory, and the application pool is correctly set to .net 4.x (being an mvc2 .net4 app). 该Web应用程序位于wwwroot目录中,并且该应用程序池已正确设置为.net 4.x(是mvc2 .net4应用程序)。

Is there anything obvious I missed? 有什么明显的我想念的吗? Pretty much everything else in the IIS configuration is default. IIS配置中的几乎所有其他内容都是默认设置。

Any help would be appreciated here. 任何帮助将不胜感激。

The URL doesn't seem valid, are you sure it's not http://localhost/getPlaces/3498 or http://localhost/getPlaces?postcode=3498 ? URL似乎无效,您确定它不是http:// localhost / getPlaces / 3498http:// localhost / getPlaces?postcode = 3498吗?

In it's current shape and assuming a default routing setup the URL will get mapped to getPlaces action method with a sinle parameter called 3498 (since its a name-value pair without the value). 在当前形状下,并假设使用默认的路由设置,URL将被映射到带有名为3498的单一参数的getPlaces动作方法(因为其名称/值对不包含该值)。 Since an identifier cannot start with a digit in .NET languages, it's not possible. 由于标识符不能以.NET语言的数字开头,因此是不可能的。

I found out it was missing the ISAPI filters, I reinstalled .net4 using the repair option, rebooted and all was fine. 我发现它缺少ISAPI筛选器,我使用修复选项重新安装了.net4,重新启动后一切都很好。 Thanks for the effort though you who posted :] 感谢您的努力,尽管您发布了:]

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

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