How can I get shadow copy to work with .NET 6.0 (beta)

Viewed 615

Has anyone had any luck getting the experimental "shadow copy" working with .NET6 and IIS? I have an IIS application pointing to my root folder for a .NET 5.0 Web API project. The first time I compile, then test the API using Postman, it works great. But after that... I am unable to compile because the dll's are locked by IIS.

I followed the advice from these online resources:

https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-net-6-preview-3/#shadow-copying-in-iis

https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-3/

https://dotnet.microsoft.com/download/dotnet/6.0

https://suhailmahmood.medium.com/asp-net-core-web-app-hosted-on-iis-without-publishing-aa238fe5c884

... and installed .NET Core hosting bundle 6.0. After that I changed my web.config to include the following settings:

<handlerSettings>
      <handlerSetting name="experimentalEnableShadowCopy" value="true" />
      <handlerSetting name="shadowCopyDirectory" value="./ShadowCopyDirectory/" />
    </handlerSettings>

The first time I run the app... shadow copies DO appear in the designated Shadow Copy directory, which seemed to indicate that it is working. However, as soon as I try to compile again... the files are still locked just like before.

Has anyone had this same issue, and figured out how to fix it?

1 Answers

I could make it work on a remote server deploy for a custom deployment pipeline. I guess running localy in debug mode causes the lockup.

Related