Comments (25)
This means that you are trying to use x86 dll in x64 proj or vice versa.
If you need x64 dll, then you can get it here Later, I build an assembly for Windows.
from mime.
hmm
I tried both x86 & x64 mode still Unable to load DLL
and the same error :
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B))
from mime.
@patachi I'm updated the package with windows support (included x64 dll). Now you do not need to install the DLL manually.
from mime.
ohh thank you ^_^
welp i create new classic win form project and added Mime with NuGet (Update Saturday, April 8, 2017 (4/8/2017)) and write a simple code like
public string TryToGetFileExtension(byte[] fileBuff)
{
var fileExtension = "";
try
{
//HeyRed.Mime.MimeGuesser.MagicFilePath = @"magic.mgc";
var tmpLength = (fileBuff.Length > 512 ? 512 : fileBuff.Length);
var tmpBuff = new byte[tmpLength];
Array.Copy(fileBuff, tmpBuff, tmpLength);
fileExtension = HeyRed.Mime.MimeGuesser.GuessExtension(tmpBuff, tmpBuff.Length);
tmpBuff = null;
}
catch (Exception exp)
{
System.Diagnostics.Debug.WriteLine(exp.Message);
}
return fileExtension;
}
and still i got this error :
Unable to load DLL 'libmagic-1': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
from mime.
Hmm, it's very strange. Which windows version you are using? 32 or 64 bit?
Off course I should've be test it with full .net framework.
from mime.
win 10 x64
from mime.
Ok, I have same system.
It seems that problem is that DLL is not copied to output directory.
from mime.
@patachi It's seems like i'm solve that problem. Update package and you will need to set platform x64 in your application.
from mime.
yup it works fine
thanks @hey-red
from mime.
@hey-red Last version (2.3.0) not working for AnyCPU platform.
Current configuration:
Win 10, x64
VS 2017, Platform: AnyCPU
from mime.
@sacerdotu change platform to x64.
from mime.
@hey-red But I need anycpu :) If I change to x64 it will work for sure.
from mime.
@hey-red This is an issue that should be fixed
at HeyRed.Mime.MagicNative.magic_open(MagicOpenFlags flags)
at HeyRed.Mime.Magic..ctor(MagicOpenFlags flags, String dbPath)
at HeyRed.Mime.MimeGuesser.GuessMimeType(String filePath)
at HeyRed.Mime.MimeGuesser.GuessFileType(String filePath)
at MimeHelper.Program.Main(String[] args) in C:\Users\sacerdotu\documents\visual studio 2017\Projects\MimeHelper\MimeHelper\Program.cs:line 28
from mime.
Currently there is no x86 support. Maybe later i'm trying to build 32-bit libmagic, and АnyCPU will be works by default.
from mime.
Perfect. Waiting for the new version!
from mime.
@hey-red Any news?
from mime.
@hey-red uploaded to azure change the application setting to 64bit but problem not solved.
getting this
check the server
but locally its working fine.. what is happening can u help me?
from mime.
@himadrinath
I did not work with azure, but if your app is self contained(contains all dependencies in working dir), then you need to copy libmagic and and other files from win runtime into directory that contains your app.
from mime.
@hey-red i did now i am getting another error
An unhandled exception occurred while processing the request.
BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
from mime.
Your VM under linux or windows?
from mime.
@hey-red windows
from mime.
@hey-red i found this aspnet/KestrelHttpServer#1625 (comment)
from mime.
Yep, its seems like app run in x86 mode. Also, by default azure VM uses x64 windows?
Change target platform to x64 and publish your app again.
from mime.
@hey-red working on it. lets see what happen. i will inform you the result
from mime.
@hey-red i changed the runtime to win-x64 and deploy to azure now its working fine. thanks for your help
from mime.
Related Issues (20)
- Implement magic_list
- Building this project to net 4.5/x86 specification
- Update documentation to mention that magic_open isn't thread safe (new Magic()) HOT 12
- missing alpine linux x64 support HOT 1
- Unable to find libmagic-1 on Ubuntu 20.04 HOT 5
- linux-musl-x64 is missing from runtimeTargets HOT 4
- Libmagic not compatibile with Xamarin on mobile devices
- Different results using filePath vs stream input HOT 2
- Got error with visual studio 2015 HOT 3
- Update File to version 5.41 HOT 7
- libmagic dependency mismatch on MacOS Monterey (5.41) HOT 2
- "Could not find any valid magic files!" when included in a Nuget package HOT 5
- native lib for M1 Mac os HOT 15
- Update file to 5.44 HOT 5
- Does not pick up Parquet files HOT 2
- Copy native libs to correct build output directory for Azure Functions
- Different extension compared to the `file` command HOT 2
- Different results on Linux and Windows
- HeyRed.Mime.MagicException: Could not find any valid magic files! on Windows Server 2012 R2 when program is on path with ů
- 3.6.0 - libmagic-1.dll flagged as virus HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mime.