如何为在经典模式下运行的池支持WebApi2 URL中的点



对于运行在Classic模式下的池,我需要在URL(如http://myserver/product/find?name=the.product.name)中支持点。

这里有很好的问题和答案:

  • 点字符'';在MVC Web API 2中,用于请求,例如API/people/STAFF.45287
  • URL中的点导致ASP.NET mvc和IIS出现404

但是它们都不适用于以经典模式运行的应用程序池。

我试过:

  1. <httpRuntime relaxedUrlToFileSystemMapping="true">...
  2. <modules runAllManagedModulesForAllRequests="true">...
  3. <handlers><add name="ApiURIs-ISAPI-Integrated-4.0" path="/people/*" verb="..." type="System.Web.Handlers.ransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  4. <modules>...<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" />

他们中没有一个在Classic中工作。

唯一不可接受的解决方法似乎是,如果点在URL中,则添加一个尾随的/;如果点在params:中,则增加一个额外的参数

  • http://myserver/product/find.all/
  • http://myserver/product/find?name=the.product.name&useless=1

我无法切换到Integrated。

尝试为classicMode 设置正确的处理程序

  <handlers>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" 
      path="*" 
      verb="GET,HEAD,POST,DEBUG,DELETE,OPTIONS" 
      modules="IsapiModule" 
      scriptProcessor="%windir%Microsoft.NETFrameworkv4.0.30319aspnet_isapi.dll" 
      preCondition="classicMode,runtimeVersionv4.0,bitness32" 
      responseBufferLimit="0" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" 
      path="*" 
      verb="GET,HEAD,POST,DEBUG,DELETE,OPTIONS" 
      modules="IsapiModule" 
      scriptProcessor="%windir%Microsoft.NETFramework64v4.0.30319aspnet_isapi.dll" 
      preCondition="classicMode,runtimeVersionv4.0,bitness64" 
      responseBufferLimit="0" />
  </handlers>