代码之家  ›  专栏  ›  技术社区  ›  sliptype

用户特定的IIS配置

  •  3
  • sliptype  · 技术社区  · 6 年前

    MyProject &燃气轮机; Properties &燃气轮机; Web MyProject.csproj.user

    然而,似乎没有办法设置默认值。这意味着克隆项目的任何人都必须自定义这些设置。

    使用特定于用户的IIS设置时,是否有方法设置默认值?

    我尝试使用环境变量,但visualstudio抱怨它无法为创建IIS绑定 http://$(API_HOST):$(API_PORT)/

    1 回复  |  直到 6 年前
        1
  •  1
  •   danilonet    6 年前

    大多数配置可以在web.config文件文件事实上此文件有“系统.webServer“专用于IIS配置的部分。

    例子:

    <system.webServer>
       <defaultDocument enabled="true">
          <files>
             <add value="Default.htm" />
             <add value="Index.htm" />
             <add value="Index.html" />
          </files>
       </defaultDocument>
       <directoryBrowse enabled="true" />
       <httpErrors>
          <error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="my_custom_404.htm" />
       </httpErrors>
       <security>
          <authentication>
             <anonymousAuthentication enabled="true" userName="IUSR" />
             <basicAuthentication />
             <clientCertificateMappingAuthentication />
             <digestAuthentication />
             <iisClientCertificateMappingAuthentication />
             <windowsAuthentication />
          </authentication>
          <requestFiltering>
             <fileExtensions allowUnlisted="true" applyToWebDAV="true" />
             <verbs allowUnlisted="true" applyToWebDAV="true" />
             <hiddenSegments applyToWebDAV="true">
                <add segment="Web.config" />
             </hiddenSegments>
          </requestFiltering>
       </security>
       <staticContent lockAttributes="isDocFooterFileName">
          <mimeMap fileExtension=".mp3" mimeType="otect/stream" />
       </staticContent>
    </system.webServer>
    

    资料来源: https://docs.microsoft.com/en-us/iis/configuration/system.webserver/