IIS初始配置需要记住的内容

最后修改时间:2018/9/5 21:11:11

全局设置:

  1. .NET全球化utf-8。
  2. 会话状态Cookie超时。
  3. 使用64位Office时候安装AccessDatabaseEngine_X64.exe
  4. 请求筛选,添加accdb。
  5. 安装URL重写,HTTP重定向HTTPS(或者写在单个网页的web.config中)。


应用程序池:

修改超时回收时间和回收规则。

单个网页设置:

需要修改debug模式,HTTP重定向HTTPS。一份样例如下。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <sessionState cookieless="UseCookies" mode="InProc" timeout="500" />
    <compilation debug="false"></compilation>
  </system.web>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

顺便,两个富文本编辑器名字记录:kindeditor(功能齐全点,没用过)、summernote(就是现在用的这个)。

SQL SERVER localDB在IIS下配置:

首次bat:
sqllocaldb h "" sharedDB
新建查询,为IIS应用程序池添加登录和数据库权限(未验证是否必须):
create login [IIS APPPOOL\.NET v4.5] from windows; exec sp_addsrvrolemember N'IIS APPPOOL\.NET v4.5', sysadmin
每次启动电脑的计划任务bat:
sqllocaldb s .\sharedDB
参考:https://www.cnblogs.com/xwgli/p/3435282.html