次の方法で共有


Web.Config

この記事は、IIS 管理 2.0.0 の時点では 非推奨です 。 と appsettings セキュリティ セクションに置き換えられました

Microsoft IIS 管理 API は、IIS によって提供されるすべての統合セキュリティ メカニズムにアクセスできます。 これらの設定は、API のインストールに付属するweb.config ファイルにあります。 このファイルでは 、Windows 認証承認 の要件が指定されています。 このファイルを操作して、API へのアクセスを許可するユーザーをカスタマイズできます。たとえば、 Windows 認証 をクライアント証明書認証に置き換えることができます。 web.config ファイルを変更した場合、"Microsoft IIS 管理" サービスを再起動して有効にする必要があります。

web.config ファイルは次の場所にあります。 IIS Administration\<version>\Microsoft.IIS.Administration\web.config

既定の設定

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Microsoft.IIS.Administration.dll" forwardWindowsAuthToken="true" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    <security>
      <authentication>
        <windowsAuthentication enabled="true" />
      </authentication>
      <authorization>
        <clear />
        <add accessType="Allow" roles="Administrators,IIS Administrators" />
      </authorization>
    </security>
  </system.webServer>
  <!-- 
       ALWAYS PROTECTED SECURITY AREA 
       THE HOST MUST PROVIDE AUTHENTICATION
       
       [Windows Authentication]
       [Client Certificate Authentication]
  -->
  <location path="security">
    <system.webServer>
      <security>
        <authentication>
          <anonymousAuthentication enabled="false" />
          <windowsAuthentication enabled="true" />
        </authentication>
        <authorization>
          <clear />
          <add accessType="Deny" users="?" />
          <add accessType="Allow" roles="Administrators,IIS Administrators" />
        </authorization>
      </security>
    </system.webServer>
  </location>
  <!-- 
      API area 
      Protected by ACCESS TOKEN
      The host can provide additional authentication on top
  -->
  <location path="api">
    <system.webServer>
      <security>
        <authentication>
          <!-- Need for CORs -->
          <anonymousAuthentication enabled="true" />
        </authentication>
        <authorization>
          <!-- Need for CORs -->
          <add accessType="Allow" verbs="OPTIONS" users="*" />
        </authorization>
      </security>
    </system.webServer>
  </location>
</configuration>