locked
Unable to load the specified metadata resource after deploying RRS feed

  • Question

  • User-1158769213 posted

    I have an ASP.NET MVC5 web site that uses EF6. When I publish (to disk package) and then deploy the web site, I find that the next time I try to debug in VS2017, I get the above error. For some reason I never worked out, cleaning the solution and rebuilding sorts it out.

    Today, I published and deployed, and found that the production web site throws the same error. Having spent a long time searching, it seems that the most common cause of this error is a mistake in the connection string. However, I don't think that's the problem in my case, as 1) the Web.config file hasn't changed for quite some time (I can see the last change in source control, and have published and deployed successfully several times since then) and b) if I copy the connection string from the published Web.config file into the one in VS, then I can run it and it loads the data from the remote database.

    Not sure it's relevant, but my PC crashed last week (wobbly memory card) and I had to reinstall Windows 10. This is the first time I've published and deployed since then. However, the file structure within the project hasn't changed, so I wouldn't expect this to be an issue.

    Anyone any idea how I find out what's gone wrong here?

    Thanks

    Monday, March 5, 2018 8:21 PM

All replies

  • User-1158769213 posted

    OK, so I'm really confused now!

    I cleaned the solution, closed VS, deleted the contents of the Publish folder, and deleted the bin and obj folders, then restarted Vs and published, and it all works fine!

    If anyone has any explanation at all for this I would like to hear it!

    Monday, March 5, 2018 8:49 PM
  • User283571144 posted

    Hi Yossu,

    According to the error message, it means the application is unable to load the EDMX.

    There multiple reason will cause this:

    You might have changed the MetadataArtifactProcessing property of the model to Copy to Output Directory.

    The connection string is wrong.

    The namespace is changed.

    I guess you may include the bin and obj folder in the application project.

    It may also cause the build error.

    Best Regards,

    Brando

    Tuesday, March 6, 2018 5:28 AM
  • User-1158769213 posted

    Hello, thanks for the reply.

    As I explained in my first post, the problem goes away by cleaning the solution and deleting the two folders (found out after that there's no need to restart VS), so I don't see how it can be related to the model, connection string or namespace.

    Not sure what you mean by your last two sentences. Please clarify.

    Thanks again.

    Tuesday, March 6, 2018 7:08 PM
  • User283571144 posted

    Hi Yossu,

    If you include the bin and obj folder in the solution like this. 

    Like this:

    The application could also build well, but it may cause some error.

    As my previous thread says, there are multiple reason will cause this error.  

    Since I couldn't reproduce the issue on my side, I could only give some possible reason.

    Best Regards,

    Brando 

    Wednesday, March 7, 2018 7:38 AM
  • User-1158769213 posted

    Thanks for the clarification.

    No, I don't have either of those folders included in my project.

    Any other ideas? Thanks again

    Wednesday, March 7, 2018 2:15 PM
  • User283571144 posted

    Hi Yossu,

    As far as I know,  by default, when you compile a Web application the compiled code is placed in the Temporary ASP.NET Files folder.

    This folder is a subdirectory of the location where you installed the .NET framework. Typically, the location is the following:

    %SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET Files
    

    When ASP.NET runs your app for the first time, it copies any assemblies found in the /bin folder, copies any source code files (found for example in the App_Code folder) and parses your aspx, ascx files to c# source files. ASP.NET then builds/compiles all this code into a runnable application.

    I guess the folder is destroyed or with wrong file after windows updated. 

    This maybe the reason.

    Best Regards,

    Brando

    Thursday, March 8, 2018 2:49 AM