there is a Web API service that I am developing in .NET (.net6). I use the Microsoft.AspNetCore.Mvc.Versioning
package to version this API service. I made developments with this package on my local site without any problems, and I was able to build and run it.
Afterwards, I published this project and added it to IIS
on my server. But after I installed it in IIS, I got the app result failed error. Thereupon, when I went to my project folder on the server and ran the dll file with the dotnet command, I received the following error:
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Versioning, Version=5.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.AspNetCore.Mvc.Versioning, Version=5.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Program.<Main>$(String[] args)
After making a few attempts, I cached the relevant package with the gacutil
command. Even though I see the relevant package folder under the assembly folder, I continue to get the same error.
NOTE: Upon the error I received, I tried using the
Asp.Versioning.Mvc.ApiExplorer
package for versioning in the project. But I encountered the same error again.
Successful operation of the service by correcting the error
I am writing here because I lost my account. I solved the problem for me. As I said, what worked locally was not working on my windows server. I tried most things on the internet so far but it wasn't working. When I was updating the service, I was either updating the json files manually or not at all. It was one of the files I did not change in MyAPI.deps.json. Without further ado, let me tell you that this problem was solved after updating the deps.json file. I hope this is a solution for those who get this error.