特定于用户的IIS配置



MyProject>Properties>Web下,有一个"将服务器设置应用于所有用户"选项,该选项将IIS配置存储在MyProject.csproj.user中。

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

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

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

您需要设置什么设置?这是一个重要的细节。大部分配置都可以在web.config文件中设置,因为该文件有一个专门用于IIS配置的"system.webServer"部分。

示例:

<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%inetpubcusterr" 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://learn.microsoft.com/en-us/iis/configuration/system.webserver/

最新更新