asp.net-core-webapi - Asp.Net Core Web Api:从 App.config 文件中读取 Nlog 配置未加载目标
问题描述
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog internalLogFile="c:\Utilities\internal_log_file.txt">
<extensions>
<add assembly="NLog.Web.AspNetCore" />
</extensions>
<targets>
<target name="logfile" xsi:type="file" fileName="C:/Utilities/${shortdate}_log.txt" layout="${longdate} ${level:uppercase=true} ${message}"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="logfile" />
</rules>
</nlog>
</configuration>
当我尝试从 nlog.config 读取它时,我无法从 App.config 读取配置。
我正在尝试拥有一个可以存储在公共位置的通用配置文件,并且其他 api 也可以加载相同的配置或日志,而不是分别为每个 api 设置配置文件。
解决方案
推荐阅读
- javascript - 使用 URL 从 Firestore 检索文档
- c# - 获取行值列表视图 ASP.NET MVC
- java - Spring MVC 将战争部署到 tomcat 8.5
- r - 模拟正态分布比在 R 中使用 rnorm() 或标准正态函数更好的方法?
- sql - 带视图的 Oracle 慢速连接
- rtf - 如何在 RTF 模板 BI 发布者中将货币数字翻译成法语单词?
- r - Kable:如何根据行中其他值的比例对值使用条件格式
- apache-kafka - 使用 kafka 流处理器 api 处理失败的消息
- markdown - 为什么这个markdown文本渲染得这么大?
- build - 我可以使用 cargo install 分发由 build.rs 构建的二进制文件吗?