zoukankan      html  css  js  c++  java
  • Web Config配置备忘

    数据压缩

    <httpCompression>节点用于配置静态压缩和动态压缩,<urlCompression>则用于开关 http压缩

      <urlCompression doStaticCompression="true" />
        <httpCompression directory="%SystemDrive%websites\_compressed" minFileSizeForComp="1024">
          <scheme name="gzip" dll="%Windir%system32inetsrvgzip.dll" />
          <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="application/json" enabled="true" />
            <add mimeType="*/*" enabled="false" />
          </staticTypes>
        </httpCompression>
    

    security

    maxAllowedContentLength设置上传文件的最大值,allowDoubleEscaping是否检查URL含有+号的情况

      <security>
          <requestFiltering allowDoubleEscaping="true">
            <requestLimits maxAllowedContentLength="10000000" />
          </requestFiltering>
        </security>
    

    mailSettings

    主要有利于SmtpClient,如果把配置写在APPSetting中需要手动去填充参数,如果使用mailSettings,情况就变得非常简单

    smtp = new SmtpClient(); smtp.Send(msg);

      <system.net>
        <mailSettings>
          <smtp from="lnred@lexisnexis.com.au">
            <network host="smtp.sendgrid.net" port="25" 
    userName="azure_b1d335d1d151b1708ffa17cfabc2ad3d@azure.com"
    password="onr4qv2s" /> </smtp> </mailSettings> <defaultProxy enabled="true" /> </system.net>

    httpProtocol

    貌似Remove Server不起作用

        <httpProtocol>
          <customHeaders>
            <!--<add name="Arr-Disable-Session-Affinity" value="true" />-->
            <remove name="Server" />
            <remove name="X-Powered-By" />
            <remove name="X-AspNet-Version" />
    	<add name="X-UA-Compatible" value="IE=EmulateIE7" />
          </customHeaders>
        </httpProtocol>
    

    system.web

    maxRequestLength和maxAllowedContentLength具有相似的目的,
    建议设置成相同的值,具体参考https://forums.iis.net/t/1169846.aspx

      <system.web>
        <compilation targetFramework="4.6" debug="false" />
        <httpRuntime targetFramework="4.6" maxRequestLength="10000" maxUrlLength="1024" />
        <customErrors mode="RemoteOnly" defaultRedirect="~/error.html" />
      </system.web>
    
  • 相关阅读:
    SpringBoot的多环境配置及配置文件位置
    SpringBoot;yaml配置, JSR303校验
    springboot原理探寻,自动装配
    SpringBoot入门:搭建SpringBoot
    Android控件阴影库
    Android开发Utils工具类集合
    Android 实现顶部状态栏的沉浸模式(任意设置状态栏的颜色)
    推荐一个博客代码高亮插件
    H5+Css+js 做App UI 与原生的区别
    Android线程切换简便方法
  • 原文地址:https://www.cnblogs.com/LittleFeiHu/p/6256213.html
Copyright © 2011-2022 走看看