dotnet / dotnet/aspnetcore

Shadow Copy on IIS when new version of SDK is installed fails.

Open
#48,296 13 comments 0 reactions 0 assignees View on GitHub
area-networking feature-iis
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

I can't duplicate this since it's a version update issue.

Scenario:

* Publishing an .NET 7.0 application to IIS.
* I installed an updated of the Windows Hosting Pack on the server
* Published an application built with latest 7.0 SDK (ie. should be in sync with just installed version)

App failed to run with error in the IIS ASP.NET Core Hosting Module:

> **Could not find 'aspnetcorev2_inprocess.dll'. Exception message:**
A JSON parsing exception occurred in [c:\Web Sites\ShadowCopyDirectory\208\Westwind.Webstore.Web.deps.json], offset 63817 (line 1720, column 9): Missing a comma or '}' after an object member.
Error initializing the dependency resolver: An error occurred while parsing: c:\Web Sites\ShadowCopyDirectory\208\Westwind.Webstore.Web.deps.json

### Eventual Solution:

1. Turn off Shadow Copy in web.config - app runs
2. Delete Shadow Copy folder and let it recreate - app runs

By chance I tried the latter and that worked - the app now runs consistently.

It appears that the Shadow Copy folder incorrectly was caching some dependencies when the .NET/ASP.NET Runtimes were updated. I would expect each new Shadown copy 'instance` to get a new and self-contained environment, but by the sound of it something from that folder was cached and not using the newly installed runtime version.

### Expected Behavior

Shadow Copy folder should not cause problems when new runtime is installed.

### Steps To Reproduce

Not easily reproducable without uninstalling reinstalling runtimes.

### Exceptions (if any)

_No response_

### .NET Version

7.0.5

### Anything else?

* .NET 7.0.5 on both dev and live site
* Using Shadow Copy in web.config
* Inprocess hosting
* App has no custom version rules

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.