none
Could not load file or assembly 'EntityFramework, Version=5.0.0.0,

    Question

  • I've create a new Azure website and am seeing the error below. The (really) odd thing is, I have another website instance that I have been working on for a while that is working just fine. I have published the exact same code to both instances; one works and one shows the following error.

    Any help is appreciated.

    Server Error in '/' Application.

    Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.BadImageFormatException: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest.

    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be loaded.
    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].
    

    Stack Trace:
    [BadImageFormatException: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest.]
       GMWebApp.Controllers.Admin.AdminController..ctor() +0
    
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
       System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
       System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113
       System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
       System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
       System.Activator.CreateInstance(Type type) +6
       System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +55
    
    [InvalidOperationException: An error occurred when trying to create a controller of type 'GMWebApp.Controllers.Admin.AdminController'. Make sure that the controller has a parameterless public constructor.]
       System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +178
       System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +77
       System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +66
       System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +191
       System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +50
       System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
       System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
    

    Wednesday, November 14, 2012 1:25 AM

Answers

  • WZhao - Good guess, I investigated that as well before posting here. It actually turned out to be a corrupt dll (I think). I re-pushed the entire website via FTP (previously I was using the web deploy) and it started working. I think the web deploy is just doing a diff when it pushes so the corrupt dll stayed up on the server until it was overwritten by the FTP which copied everything up.

    That is my theory anyway. Thankfully it is working.

    Wednesday, November 14, 2012 6:00 PM

All replies

  • the error is System.BadImageFormatException.

    This should be due to the assembly is not plantform independent. WAWS site runs as WOW process(32bit process on 64bit machine).

    The assembly is for X64 platform?

    Thanks,

    Wednesday, November 14, 2012 8:31 AM
    Moderator
  • WZhao - Good guess, I investigated that as well before posting here. It actually turned out to be a corrupt dll (I think). I re-pushed the entire website via FTP (previously I was using the web deploy) and it started working. I think the web deploy is just doing a diff when it pushes so the corrupt dll stayed up on the server until it was overwritten by the FTP which copied everything up.

    That is my theory anyway. Thankfully it is working.

    Wednesday, November 14, 2012 6:00 PM