码迷,mamicode.com
首页 > Windows程序 > 详细

.net webapi跨域 web.config配置

时间:2019-08-07 13:20:53      阅读:253      评论:0      收藏:0      [点我收藏+]

标签:webdav   handler   uri   ora   nal   get   config   its   prot   

<system.webServer>

<httpProtocol>

<customHeaders>

<add name="Access-Control-Allow-Origin" value="*" />

<add name="Access-Control-Allow-Headers" value="Content-Type" />

<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />

</customHeaders>

</httpProtocol>

<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>
<system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1048576000"></requestLimits>
      </requestFiltering>
    </security>

    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Headers" value="x-requested-with" />
        <add name="Access-Control-Allow-Methods" value="POST,GET,OPTIONS,DELETE,PUT" />
        <remove name="X-Powered-By" />
      </customHeaders>
    </httpProtocol>

    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
    </modules>


    <staticContent>
      <remove fileExtension=".woff" />
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
      <mimeMap fileExtension=".woff2" mimeType="application/font-woff" />
    </staticContent>
    <handlers>
      <remove name="WebDAV" />
      <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>

 

.net webapi跨域 web.config配置

标签:webdav   handler   uri   ora   nal   get   config   its   prot   

原文地址:https://www.cnblogs.com/eedc/p/11314668.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!