我有一个Web Api应用程序.当我使用VS 2010调试开发服务器测试它时,它运行得非常好.但我现在将其部署到IIS 7.5,并在尝试访问应用程序时收到HTTP 404错误.
这是我的web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-FlowGearProxy-20123141219;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="true" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" …Run Code Online (Sandbox Code Playgroud) 我编写了一个使用ASP.NET MVC Web API的站点,一切都运行良好,直到我把它放在登台服务器上.该站点在我的本地计算机和开发Web服务器上运行良好.开发和登台服务器都是Windows Server 2008 R2.
问题是:基本上网站工作,但有一些API调用使用HTTP PUT方法.这些失败在分段返回404,但在其他地方工作正常.
我遇到并修复的第一个问题是请求过滤.但仍然得到404.
我在IIS中打开了跟踪并遇到以下问题.
168. -MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName IIS Web Core
Notification 16
HttpStatus 404
HttpReason Not Found
HttpSubStatus 0
ErrorCode 2147942402
ConfigExceptionInfo
Notification MAP_REQUEST_HANDLER
ErrorCode The system cannot find the file specified. (0x80070002)
Run Code Online (Sandbox Code Playgroud)
开发和分期时的配置是相同的,事实上整个站点是直接副本.
为什么GET和POST工作,而不是PUT?