IIS Express在哪里将VS2017 / .NET Core的日志文件写入日志文件?

时间:2018-12-11 15:55:46

标签: asp.net-core-webapi iis-express

我有一个由IIS Express托管的.NET Core 2.2 Web API项目,并尝试查找某些失败请求的w3c日志文件。

我的解决方案级别.vs \ config \ applicationhost.config具有以下内容:

<siteDefaults> <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" /> <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" /> </siteDefaults>

如果尝试浏览到%IIS_USER_HOME%,则会出现错误对话框,提示Windows找不到“%IIS_USER_HOME%”。如何找到该文件夹​​?

VS2017 Windows 10 .NET Core 2.2

1 个答案:

答案 0 :(得分:1)

从评论中复制。

applicationHost.config文件的前几行实际上指示值,

<!--
    IIS configuration sections.
    For schema documentation, see
    %IIS_BIN%\config\schema\IIS_schema.xml.

    Please make a backup of this file before making any changes to it.
    NOTE: The following environment variables are available to be used
          within this file and are understood by the IIS Express.
          %IIS_USER_HOME% - The IIS Express home directory for the user
          %IIS_SITES_HOME% - The default home directory for sites
          %IIS_BIN% - The location of the IIS Express binaries
          %SYSTEMDRIVE% - The drive letter of %IIS_BIN%
-->

因此%IIS_USER_HOME%的实际值为%USERPROFILE%\Documents\IISExpress