在IIS 7.5上运行ASP.NET Core时日志会去哪里? [英] Where do logs go when running ASP.NET Core on IIS 7.5?
问题描述
我要发布并回答这个问题,因为这使我很长一段时间都陷入困境.我的web.config
中有以下一行:
I'm posting this and answering it, because this left me stumped for a very long time. I have the following line in my web.config
:
<aspNetCore processPath="dotnet" arguments=".\XXX.Server.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
显然,这应该记录到logs\stdout
,但是当我看时,那里什么都没有.我进行了一次疯狂的追赶,在整个磁盘上搜索名为"log"(返回太多)或"stdout"(不返回任何内容)的任何东西,但仍然找不到.
So apparently, this should be logging to logs\stdout
, but when I look, there's nothing there. I went on a wild goose chase, searching the whole disk for anything named 'log' (that returned too much) or 'stdout' (that returned nothing), and still couldn't figure it out.
推荐答案
您可能可以检查计算机上的事件查看器->应用程序以查看是否记录了任何错误,这可以解释为什么没有记录文件生成.
You could probably check the Event Viewer on your machine -> Application to see if there are any errors logged, which could explain why your log files aren't being generated.
但是,最可能的原因是IIS没有写该日志文件夹的权限.
However, the most probable reason is that IIS doesn't have a permission to write to that log folder.
- 右键单击文件夹->安全性
- 确保IIS_IUSRS用户具有以下权限:读取和执行,列出,写入(默认情况下可能缺少写入)
- Right click on the folder -> Security
- Ensure that IIS_IUSRS user has the following permissions: read and execute, list, write (potentially write is missing by default)
这篇关于在IIS 7.5上运行ASP.NET Core时日志会去哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!