I have an ASP.NET Blazor web site, using .NET7 running on Windows Server 2022/IIS 10.
Due to some problems I'm having with uploads, I decided to try enabling shadow copy, as this is supposed to avoid this problem.
I followed the info on this blog post, and changed my Web.config file to look like this...
<?xml version="1.0"
encoding="utf-8"?>
<configuration>
<location path="."
inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore"
path=""
verb=""
modules="AspNetCoreModuleV2"
resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet"
arguments=".\MyWebSite.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess">
<handlerSettings>
<handlerSetting name="enableShadowCopy"
value="true" />
<handlerSetting name="shadowCopyDirectory"
value="../_ShadowCopyDirectory/" />
</handlerSettings>
</aspNetCore>
</system.webServer>
</location>
</configuration>
However, this results in the web site not starting, and a 500 being returned. If I comment out or remove the <handlerSettings> section, the site works fine.
Looking in the server event log shows an entry with a source of IIS AspNetCore Module V2 and the following description...
Could not load configuration. Exception message:
That's it, the total message.
It looks to me as if IIS isn't managing to read the config file, which would usually be because the XML is invalid, but I've checked it in a validator, and came out OK.
Although I don't think it's getting that far, the _ShadowCopyDirectory folder exists, so that's not the problem. I've enabled parent paths, so that shouldn't be it either, although as I said, my suspicion is that it's not even getting that far.
The site in question is using .NET 7, which supports this feature, so that shouldn't be the issue either. I checked the IIS logs, but they don't show anything for the times it failed to load.
Anyone any idea what might be going wrong, or where I might look for more information? The event log was no help.