首页 文章

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

提问于
浏览
4

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

这里有很多问题和答案:

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

我试过了:

  • <httpRuntime relaxedUrlToFileSystemMapping="true">...

  • <modules runAllManagedModulesForAllRequests="true">...

  • <handlers><add name="ApiURIs-ISAPI-Integrated-4.0" path="/people/*" verb="..." type="System.Web.Handlers.ransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

  • <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

我无法切换到集成。

1 回答

  • 2

    尝试此操作为 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.NET\Framework\v4.0.30319\aspnet_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.NET\Framework64\v4.0.30319\aspnet_isapi.dll" 
          preCondition="classicMode,runtimeVersionv4.0,bitness64" 
          responseBufferLimit="0" />
      </handlers>
    

相关问题