Closed dro-sh closed 5 years ago
You are using self-contained deployment? You should place all files from \runtimes\win-x64\native into output directory.
You mean place it to root of app? If I place files to root I have next problem:
BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Am I need install net core sdk 2.0 to my server?
Hmm interesting. You are publish through visual studio or command line? What OS? Is x64 windows?
Am I need install net core sdk 2.0 to my server?
You can install only .net core runtime or full sdk(the runtime is included). Also, see https://docs.microsoft.com/en-us/dotnet/core/deploying/index
Yes, I'm using VS and Web Deploy to publish to my windows server 2016(x64). I determine images mime type due to your lib. Also I use SkiaSharp to resize images. Also it isn't work (libskiasharp.dll not found). I thought that there was not enough net core 2.0 on the server. Then I uninstall net core 2.0 in my dev comp. All works on dev comp on localhost publication.
P.S. Installation runtimes SDK didnt' help.
Ok. You can show your "publish" directory? Its contains "runtimes" dir?
Yes, it contains "runtimes" and "libmagic-1.dll" next.
When I published my project using dotnet cli
sudo dotnet publish AA.csproj -c Release -r ubuntu.14.04-x64
The file magic.mgc is been created inside the published folder, but for some reazon only linux was not able to see it. Thats why I place this code in the startup of my mvc project .
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
MimeGuesser.MagicFilePath = "magic.mgc";
}
Run
find / -name magic.mgc
to verify the .mgc file is inside the proper folder you may use the absolute path as well.
Watch out if you face this error
MagicException: File 5.30 supports only version 14 magic files.
/usr/share/file/magic.mgc' is version 10` Means that I must upgrade linux o downgrade Mime version in your Nuget.
I my case the project was published and tested in ubuntu18
sudo dotnet publish AA.csproj -c Release -r ubuntu.18.04-x64
same problem here. have you found a fix or workaround, @Serfi7 ?
I didn't do anything. But not it works fine. @shazha
I have an app based on ASP.NET Core 2.1. At localhost all works fine. But than I published my app I got the problem described at title. At my publication folder I found "labmagic-1.dll" at "\runtimes\win-x64\native". I set "MimeGuesser.MagicFilePath" at absolute and relative path. But didn't help.