locked
Visual Studio 2012 Publishing conventions(I guess that's the word I am looking for)? RRS feed

  • Question

  • User-1851576699 posted

    I have been trying to track down a bug that is related specifically to the deployment/publishing process. In other words, my MVC application works locally but not after it is published. It is in regards to database issues. But my recent attempts in trying to resolve this issue have led me to an observation that wasn't obvious to me at first. It appears that the Visual Studio 2012 publishing process doesn't publish "all" the .DLLs that your project references locally. I realized this when browsing through the /bin folder of my application under the inetpub/wwwroot folder structure. All the .DLLs in my project are not present in the /bin folder after triggering/executing a publish with VS2012. So, this makes sense to save space/bandwidth because if your application doesn't ever make use of the .DLLs that are referenced in your project then theres no point in publishing them. Makes perfect sense.

    The only problem is, I seem to be experiencing an exception that is a result of attempting to call a method that is contained in a .DLL that isn't being published to the /bin folder.

    "

    EntityException
    The underlying provider failed on Open. at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults

    I got this information from the Windows 7 event viewer log. I notice in the exception that a call is made to System.Data.EntityClient.EntityConnection.Open() method. That specific method resides in the System.Data.Entity.dll which is not being published to my /bin folder under inetpub. I wonder if this .DLL is not being marked as necessary in the publish process for some reason. Would this exception line-up with the .DLL being missing or would it be throwing a different exception?

    ** EDIT **: I copied the System.Data.Entity.dll into my /bin directory under /inetpub and it didn't make the exception go away. It makes me wonder, though, how my application could ever run correctly without the System.Data.Entity.dll being in the /bin folder from the start.

    Thursday, October 3, 2013 10:42 AM

Answers

  • User753101303 posted

    Hi,

    Actually, this message means that the "underlying provider" (that is the ADO.NET provider EF uses to get access to the db) failed. More likely your connection string is wrong (for example the server name is not correct for your production environment).

    This is not a DLL issue (the message just tells that the error happens inside a method in this assembly, also keep in mind that bin contains your assemblies, your app still relies largely on DLLs that are installed once for all on the server in the Global Assembly Cache).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 5, 2013 1:54 PM