Ich habe eine VS 2022 ASP.NET -Kernlösung, die unter .NET 8.0 funktioniert. Ich habe das TargetFramework auf net9.0 aktualisiert und alles funktioniert normal. Dann habe ich den gesamten Nlog aktualisiert. Ich erhalte ein System.
Code: Select all
logger = NLog.LogManager.Setup()
.LoadConfigurationFromAppSettings().GetCurrentClassLogger();
Im Moment bin ich gut, da ich mich bei 5.3.11 halten kann, aber seien Sie sich bewusst, dass Sie hier etwas Latentes gibt, das Sie ansprechen müssen. < /p>
Update: Nlog-internal.txt Inhalt von 5.3.12, wie von @rolfkristensen, unter der Stapelspur generiert. Wenn ich wieder auf 5.3.11 zurück bin, endet die ähnliche Ausgabe nicht dort, wo es in .12: < /p>
erfolgt
Code: Select all
2024-11-20 15:41:38.5470 Debug Skip loading NLogLoggingConfiguration from empty config section: NLog
2024-11-20 15:41:38.5834 Info Loading NLog config from XML file: Z:\rwells\very\special\NLog.config
...normal loading proceeds...
Prost ,
Richard < /p>
Stapelspur < /strong> < /p>
Code: Select all
System.UriFormatException
HResult=0x80131537
Message=Invalid URI: The hostname could not be parsed.
Source=System.Private.Uri
StackTrace:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString, UriKind uriKind)
at System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri)
at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
at System.Xml.XmlReader.Create(String inputUri)
at NLog.Internal.Fakeables.AppEnvironmentWrapper.LoadXmlFile(String path)
at NLog.Config.XmlLoggingConfiguration.CreateFileReader(String fileName)
at NLog.Config.XmlLoggingConfiguration.LoadFromXmlFile(String fileName)
at NLog.Config.XmlLoggingConfiguration..ctor(String fileName, LogFactory logFactory)
at NLog.Web.SetupBuilderExtensions.c__DisplayClass0_0.b__2(ISetupLoadConfigurationBuilder config)
at NLog.SetupBuilderExtensions.LoadConfiguration(ISetupBuilder setupBuilder, Action`1 configBuilder)
at NLog.Web.SetupBuilderExtensions.LoadConfigurationFromAppSettings(ISetupBuilder setupBuilder, String basePath, String environment, String nlogConfigSection, Boolean optional, Boolean reloadOnChange)
at Program.$(String[] args) in Z:\rwells\very\special\Program.cs:line 20
Code: Select all
2024-11-20 15:28:06.7547 Debug No file exists at candidate config file location: \\?\UNC\rwells\very\special\bin\Development\net9.0\IDService.exe.nlog
2024-11-20 15:28:06.7547 Debug No file exists at candidate config file location: \\?\UNC\rwells\very\special\bin\Development\net9.0\IDService.dll.nlog
2024-11-20 15:28:06.7779 Debug Reading config from XML file: \\?\UNC\rwells\very\special\bin\Development\net9.0\NLog.config
2024-11-20 15:28:06.8262 Error Failed loading from config file location: \\?\UNC\rwells\very\special\bin\Development\net9.0\NLog.config Exception: System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString, UriKind uriKind)
at System.Xml.XmlResolver.ResolveUri(Uri baseUri, String relativeUri)
at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
at System.Xml.XmlReader.Create(String inputUri)
at NLog.Internal.Fakeables.AppEnvironmentWrapper.LoadXmlFile(String path)
at NLog.Config.LoggingConfigurationFileLoader.LoadXmlLoggingConfigurationFile(LogFactory logFactory, String configFile)
at NLog.Config.LoggingConfigurationFileLoader.TryLoadLoggingConfiguration(LogFactory logFactory, String configFile, LoggingConfiguration& config)
2024-11-20 15:28:06.8446 Debug No file exists at candidate config file location: \\?\UNC\rwells\very\special\bin\Development\net9.0\NLog.dll.nlog
2024-11-20 15:28:06.8465 Info NLog Configuration has not been loaded.
2024-11-20 15:28:07.3532 Debug No file exists at candidate config file location: \\?\UNC\rwells\very\special\bin\Development\net9.0\nlog.Development.config
Code: Select all
$paths = (
'\\sharepoint.business.com\DavWWWRoot\rs\project 1\document.txt',
'Z:\rwells\very\special\place',
'\\actual-hostname\actual-sharename\rwells\very\special\place',
'\\?\UNC\actual-hostname\actual-sharename\rwells\very\special\place'
)
foreach ($path in $paths) {
echo "$path ->"
$uri = [System.Uri]$path
echo " $($uri.AbsoluteUri) [is UNC = $($uri.IsUnc)]"
}
Code: Select all
\\sharepoint.business.com\DavWWWRoot\rs\project 1\document.txt ->
file://sharepoint.business.com/DavWWWRoot/rs/project%201/document.txt [is UNC = True]
Z:\rwells\very\special\place ->
file:///Z:/rwells/very/special/place [is UNC = False]
\\actual-hostname\actual-sharename\rwells\very\special\place ->
file://actual-hostname/actual-sharename/rwells/very/special/place [is UNC = True]
\\?\UNC\actual-hostname\actual-sharename\rwells\very\special\place ->
InvalidArgument: Z:\rwells\Temp\uri-hacking.ps1:11
Line |
11 | $uri = [System.Uri]$path
| ~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot convert value "\\?\UNC\actual-hostname\actual-sharename\rwells\very\special\place" to type "System.Uri". Error: "Invalid URI: The hostname could not be parsed."
file://actual-hostname/actual-sharename/rwells/very/special/place [is UNC = True]