I have an API-only site (no pages) that is terminating as soon as it starts.
I found the following errors in Event Viewer.
Application: w3wp.exe
CoreCLR Version: 6.0.21.52210
.NET Version: 6.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Program.<Main>$(String[] args)
And...
Application '/LM/W3SVC/18/ROOT' with physical root 'C:\inetpub\wwwroot\tt.railtrax.com\' hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs:
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.EntityFrameworkCore, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Program.<Main>$(String[] args)
When I look at Microsoft.EntityFrameworkCore.dll in my deploy folder, it appears to be version 6.0.21.
Package Manager says I have 6.0.1 installed. So I don't know why I have 6.0.21, or if it should work with that version.
Does anyone know if these version discrepancies matter, or what else I could try to resolve this?
The project is running fine on my own computer. I very recently upgraded all the suggested packages in Package Manager. I assume it happened as a result of that.
UPDATE:
Some additional information:
- As can be seen from the error message, the project I'm having trouble with is TTRailtrax.
- TTRailtrax has a dependency on RailtraxCore, which has Microsoft.EntityFrameworkCore.dll installed.
- I am deploying to a local folder and then manually copying those files to the server. This has been working until now.
- The only thing I can think that changed is that I updated the recommended NuGet packages.
- The project continues to run fine on my local computer.
- I have confirmed the same version of Microsoft.EntityFrameworkCore.dll exists on my local machine and the server.
- I have cleaned my solution.
- I uninstalled and then re-installed Microsoft.EntityFrameworkCore.dll twice now.
- I have restarted the app on IIS several times.
- I have redeployed to the server several times.
- I have updated Visual Studio to the very latest version.
UPDATE:
Upon further investigation, I see that my bin\Release\net6.0 folder, contains Microsoft.EntityFrameworkCore.dll with product version 6.0.1. But then in my deployment folder, this file has product version 6.0.0.
It seems highly likely that this is related to the issue I'm seeing. Under what circumstances would a different DLL version be placed in my deployment folder than the one in my bin folder?
I tried copying the file from the bin folder but that didn't help.