执行控制台应用程序时抛出BadImageFormatException错误

时间:2015-05-28 12:52:23

标签: c# visual-studio-2010 wcf c#-4.0 windows-8

我在执行C#控制台应用程序时遇到错误。在我看来,这是机器特定的问题。它正在我的Windows 8机器上使用.Net framework 4.5。但它不能在我朋友的PC上使用相同的配置。我不知道如何解决这个问题。

我尝试更改 Visual Studio 应用程序属性 - 将属性构建为“X86”和“任何CPU”。但它不起作用。

请帮助。

   System.BadImageFormatException: Could not load file or assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f
    5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
    File name: 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
       at System.ServiceModel.Diagnostics.TraceUtility.SetEtwProviderId()
       at System.ServiceModel.ChannelFactory..ctor()
       at System.ServiceModel.ChannelFactory`1..ctor(Type channelType)
       at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
       at System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory()
       at System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory()
       at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
       at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
       at System.ServiceModel.ClientBase`1..ctor()
       at ApiKeyVerifier.Program.Main(String[] args) in D:\Projects\ApiKeyVerifier\Program.cs:line 17

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

0 个答案:

没有答案