none
Unable to load the specified metadata resource. RRS feed

  • Question

  • Hi,

    My code excuted a while back but when i excute it gagain it is giving an error.  Can some please help  me out. What is this error and why am I getting it

    I Have recently upgraded Autofac and entityframework, is this because of that? 

    Unable to load the specified metadata resource.

    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.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource. Source Error: 

    Line 58:         /// </summary>

    Line 59:         public ADataMartEntities(string connectionString) :

    Line 60:                 base(connectionString, "ADataMartEntities")

    Line 61:         {

    Line 62:             this.ContextOptions.LazyLoadingEnabled = true;

    Source File: C:\Users\c200433\A Anaylytics\Risk_Based_Monitoring\Analytics\Releases\R2.6.07( Bug Fix CHG0783660)\ADashboard\Show.ADashboard\EntityFramework\ADataMart\ADataMart.Designer.cs    Line: 60  Stack Trace: 

    [MetadataException: Unable to load the specified metadata resource.]

       System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver) +314

       System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver) +173

       System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver) +39

       System.Data.Entity.Core.Metadata.Edm.MetadataCache.SplitPaths(String paths) +534

       System.Data.Entity.Core.Common.Utils.<>c__DisplayClass2.<Evaluate>b__0() +18

       System.Data.Entity.Core.Common.Utils.Result.GetValue() +130

       System.Data.Entity.Core.Common.Utils.Memoizer`2.Evaluate(TArg arg) +354

       System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetArtifactLoader(DbConnectionOptions effectiveConnectionOptions) +62

       System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions) +30

       System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace() +43

       System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection() +20

       System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory) +395

       System.Data.Entity.Core.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) +35

       Show.ADashboard.EntityFramework.ADataMart.ADataMartEntities..ctor(String connectionString) in C:\Users\c200433\A Anaylytics\Risk_Based_Monitoring\Analytics\Releases\R2.6.07( Bug Fix CHG0783660)\ADashboard\Show.ADashboard\EntityFramework\ADataMart\ADataMart.Designer.cs:60

       lambda_method(Closure , Object[] ) +81

       Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +214

    [DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(System.String)' on type 'ADataMartEntities'. ---> Unable to load the specified metadata resource. (See inner exception for details.)]

       Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +500

       Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +174

       Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48

       Autofac.Core.Resolving.InstanceLookup.Execute() +48

       Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133

       Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24

       Autofac.Core.Registration.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable`1 p) +19

       Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32

       Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48

       Autofac.Core.Resolving.InstanceLookup.Execute() +48

       Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133

       Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24

       Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0() +25

       Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94

       Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +174

       Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48

       Autofac.Core.Resolving.InstanceLookup.Execute() +48

       Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133

       Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24

       Autofac.Core.Registration.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable`1 p) +19

       Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32

       Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48

       Autofac.Core.Resolving.InstanceLookup.Execute() +48

       Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133

       Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +64

       Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +108

       Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74

       Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters) +54

       Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType) +84

       Autofac.Integration.Mvc.AutofacDependencyResolver.GetService(Type serviceType) +21

       System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +41

    [InvalidOperationException: An error occurred when trying to create a controller of type 'Show.ADashboard.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor.]

       System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +179

       System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +79

       System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74

       System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +214

       System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +49

       System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +49

       System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +18

       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +103

       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


    • Edited by adityakommu Tuesday, September 13, 2016 12:19 AM
    Tuesday, September 13, 2016 12:11 AM

Answers

  • Then try the troubleshooting steps outlined in here.
    Tuesday, September 13, 2016 2:53 AM
    Answerer
  • Hi adityakommu,

    According to your description and error message, it seems that the application is unable to load the EDMX, Please try the following solutions.

    1. Downgrading to EF to original version.

    2. Deleting the EDMX file, and create it again.

    If the issue still exist, could you please provide a simple demo via OneDrive, we'll reproduce your issue on our side and try to find a solution to resolve it.

    Best regards,

    Cole Wu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, September 28, 2016 6:50 AM
    Moderator

All replies

  • It could be... check your web.config to see if you can still find the "ADataMartEntities" key in your connection strings section. If you can't, please try copy the entry back from your project containing the EntityFramework (I'm assuming your project arrange in proper MVC fashion where thr data layer and the web are in different projects.)
    Tuesday, September 13, 2016 1:28 AM
    Answerer
  • Connection string exsists and it is correct  and shockingly same code excute in my friend computer.

    Is there a way to rollback  refrences to prevoious ones. ?If so please let me konw

    Tuesday, September 13, 2016 2:10 AM
  • Then try the troubleshooting steps outlined in here.
    Tuesday, September 13, 2016 2:53 AM
    Answerer
  • Hi I have tried steps mentioned but still getting the same error Is there a way i can get detailed stacktrace Thanks for your help
    Wednesday, September 21, 2016 1:18 AM
  • Hi adityakommu,

    According to your description and error message, it seems that the application is unable to load the EDMX, Please try the following solutions.

    1. Downgrading to EF to original version.

    2. Deleting the EDMX file, and create it again.

    If the issue still exist, could you please provide a simple demo via OneDrive, we'll reproduce your issue on our side and try to find a solution to resolve it.

    Best regards,

    Cole Wu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, September 28, 2016 6:50 AM
    Moderator