WebDAVModule issue

When i use location path=“api” , remove name=“WebDAVModule” can not work. Could you tell me how to add the two config at sametime.

<location path="api">
  <system.web>
    <httpRuntime targetFramework="4.5" />

    <httpHandlers>
      <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <modules>
      <remove name="WebDAVModule" />
    </modules>
    <validation validateIntegratedModeConfiguration="false" />
    <urlCompression doStaticCompression="true" doDynamicCompression="false" />
    <handlers>
      <remove name="WebDAV" />
      <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
    </handlers>
  </system.webServer>
</location>

I use this config to fix the issue

 <!-- <location path="api"> -->
    <system.web>
      <httpRuntime targetFramework="4.5" />

      <httpHandlers>
        <add path="api*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" />
      </httpHandlers>
    </system.web>
    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true">
        <remove name="WebDAVModule" />
      </modules>
      <validation validateIntegratedModeConfiguration="false" />
      <urlCompression doStaticCompression="true" doDynamicCompression="false" />
      <handlers>
        <remove name="WebDAV" />
        
        <add path="api*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
      </handlers>
    </system.webServer>
  <!-- </location> -->