Giter VIP home page Giter VIP logo

Comments (25)

hey-red avatar hey-red commented on May 27, 2024

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.

patachi avatar patachi commented on May 27, 2024

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.

hey-red avatar hey-red commented on May 27, 2024

@patachi I'm updated the package with windows support (included x64 dll). Now you do not need to install the DLL manually.

from mime.

patachi avatar patachi commented on May 27, 2024

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.

hey-red avatar hey-red commented on May 27, 2024

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.

patachi avatar patachi commented on May 27, 2024

win 10 x64

from mime.

hey-red avatar hey-red commented on May 27, 2024

Ok, I have same system.
It seems that problem is that DLL is not copied to output directory.

from mime.

hey-red avatar hey-red commented on May 27, 2024

@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.

patachi avatar patachi commented on May 27, 2024

yup it works fine
thanks @hey-red

from mime.

sacerdotu avatar sacerdotu commented on May 27, 2024

@hey-red Last version (2.3.0) not working for AnyCPU platform.
Current configuration:
Win 10, x64
VS 2017, Platform: AnyCPU

from mime.

hey-red avatar hey-red commented on May 27, 2024

@sacerdotu change platform to x64.

from mime.

sacerdotu avatar sacerdotu commented on May 27, 2024

@hey-red But I need anycpu :) If I change to x64 it will work for sure.

from mime.

sacerdotu avatar sacerdotu commented on May 27, 2024

@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.

hey-red avatar hey-red commented on May 27, 2024

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.

sacerdotu avatar sacerdotu commented on May 27, 2024

Perfect. Waiting for the new version!

from mime.

sacerdotu avatar sacerdotu commented on May 27, 2024

@hey-red Any news?

from mime.

himadrinath avatar himadrinath commented on May 27, 2024

@hey-red uploaded to azure change the application setting to 64bit but problem not solved.
getting this

mime_1

check the server

mime_2

but locally its working fine.. what is happening can u help me?

from mime.

hey-red avatar hey-red commented on May 27, 2024

@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.

himadrinath avatar himadrinath commented on May 27, 2024

@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.

hey-red avatar hey-red commented on May 27, 2024

Your VM under linux or windows?

from mime.

himadrinath avatar himadrinath commented on May 27, 2024

@hey-red windows

from mime.

himadrinath avatar himadrinath commented on May 27, 2024

@hey-red i found this aspnet/KestrelHttpServer#1625 (comment)

from mime.

hey-red avatar hey-red commented on May 27, 2024

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.

himadrinath avatar himadrinath commented on May 27, 2024

@hey-red working on it. lets see what happen. i will inform you the result

from mime.

himadrinath avatar himadrinath commented on May 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.