Skip to content

Error: An attempt was made to load a program with an incorrect format #84

Description

@Douuuglas

First of all: thanks for sharing this well written library!

Situation

I've made an installer with WixSharp, in this installer i validate if the windows machine has the component "WCF-HTTP-Activation" activated. On some machines it's working, but in an azure Windows Server 2012 machine i'm having problems when i execute the code above.
See if you can help me!

Here's the code

internal static bool IsHTTActivation35Ativated()
{
    try
    {
        DismApi.Initialize(DismLogLevel.LogErrors);
        using (var session = DismApi.OpenOnlineSession())
        {
            var feature = DismApi.GetFeatureInfo(session, "WCF-HTTP-Activation");
            if (feature == null)
                return false;
            if (feature.FeatureState != DismPackageFeatureState.Installed)
                return false;
            return true;
        }
    }
    catch
    {
        return false;
    }
    finally
    {
        DismApi.Shutdown();
    }
}

Here's the error messages

An attempt was made to load a program with an incorrect format.

StackTrace

   at BecomexInstaller.InstallerConfig.PrerequisitesInstallerConfig.IsHTTActivation35Ativated()   at Microsoft.Dism.DismUtilities.ThrowIfFail(Int32 hresult, DismSession session)
   at Microsoft.Dism.DismSession.Reload()
   at Microsoft.Dism.DismApi.OpenOnlineSession()

Project config

image

System where it's not working

image

System where it's working

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions