Iis 7 IIS 7无法路由请求:错误404,未找到文件

Iis 7 IIS 7无法路由请求:错误404,未找到文件,iis-7,asp.net-web-api,owin,Iis 7,Asp.net Web Api,Owin,我已经创建了我的第一个owin/web.api REST服务。 超级简单的东西,只是为了测试一些功能 我使用Visual Studio 2013创建了一个空项目,并安装了以下软件包: Microsoft.AspNet.WebApi.Client Microsoft.AspNet.WebApi.Core Microsoft.AspNet.WebApi.Owin Microsoft.Owin Microsoft.Owin.Diagnostics Microsoft.Owin.Host.System

我已经创建了我的第一个owin/web.api REST服务。 超级简单的东西,只是为了测试一些功能

我使用Visual Studio 2013创建了一个空项目,并安装了以下软件包:

  • Microsoft.AspNet.WebApi.Client
  • Microsoft.AspNet.WebApi.Core
  • Microsoft.AspNet.WebApi.Owin
  • Microsoft.Owin
  • Microsoft.Owin.Diagnostics
  • Microsoft.Owin.Host.SystemWeb
  • Json
  • 奥温
这是我的创业课程:

[assembly: OwinStartup(typeof(OwinO.Startup))]
namespace OwinO
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
        HttpConfiguration config = new HttpConfiguration();

        config.MapHttpAttributeRoutes();

        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
            );

        app.UseWebApi(config);

        app.UseWelcomePage("/");
        app.UseErrorPage();
        }
   }
}
这是我的Api控制器:

[RoutePrefix("api/v1")]
public class TestController : ApiController
{
    [HttpGet]
    [Route("test")]
    public async Task<IHttpActionResult> Get()
    {
        string name = "Mister";
        string sayHello = string.Empty;

        Task<string> t = new Task<string>(() =>
        {
            sayHello = string.Format("Hello {0}", name);
            return sayHello;
        });
        t.Start();
        await t;

        return Ok(new string[] { sayHello });
    }
}
我已经检查了IIS日志,请求到达IIS。 只是它不知道怎么走

为了交叉检查这个问题,我创建了一个没有Owin的简单web.api(使用相同的路由系统),它可以工作


同一个Owin应用程序自托管工作。

没有修复此问题

我花了大量的时间试图找到一个解决方案或解决方法。
服务器升级后,一切正常。

您是如何解决此问题的?看来我也有同样的问题,不知道该怎么办…@ultraman69:我现在已经回答了我自己的问题。我想没有办法解决这个问题。我已经升级到一个新的IIS,一切正常。
<system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
</system.web>

<system.webServer>
  <!--<modules runAllManagedModulesForAllRequests="true" />-->
    <handlers>
        <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
        <remove name="OPTIONSVerbHandler" />
        <remove name="TRACEVerbHandler" />
        <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
</system.webServer>
[RoutePrefix("api/v1")]