none
EF6 Context cannot be used while the model is being created

    Question

  • I have a very simple EF6.1.3 console application test program generated via the EDMX 'code-first from database' wizard. The database is located on a SQL Server 2008 R2 instance on the network. My main program simply uses the data context to query a table and display the count of the number of items.

    The source code for this VS2013 solution normally resides on a UNC path. When I run the program (either from VS2013 or from a command prompt), I either get the exception 'Context cannot be used while the model is being created' or 'A non-recoverable error occurred during a database lookup.'.

    If I copy the entire solution to a folder on my local C: drive and run it from there, everything works just fine with no errors.

    I suspect this may have something to do with different trust levels between a UNC path and a local drive. Can anyone confirm and provide details on how to change the trust level of the UNC path.


    • Moved by Fred Bao Wednesday, June 10, 2015 6:24 AM Not A EntityFramework Related issue
    Tuesday, June 09, 2015 9:05 PM

Answers

All replies

  • Hello Alan,

    >> Can anyone confirm and provide details on how to change the trust level of the UNC path.

    For this question, it is beyond the scope of our support for this forum which is used to talk about the Entity Framework itself. For this case, I move it to the where the forum is for forum there are forum experts would help redirect it to a proper forum.

    Regards.


    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, June 10, 2015 6:24 AM
  • Hello,

    You might ask on the Entity Framework discussions on CodePlex:

    https://entityframework.codeplex.com/discussions

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Wednesday, June 10, 2015 2:34 PM
    Moderator
  • I don't think the forum mentioned is suitable as it for questions on Entity Framework open source code base

    The crux of my question is not so much about Entity Framework but more about understanding why a .NET 4.5 executable which happens to use EF to talk to a database throws errors when run from a UNC drive but runs perfectly when run from a local drive (e.g. C:). I am guessing it is a trust issue and was hoping someone from MS could confirm and propose a solution (if there is one).

    Thursday, June 11, 2015 12:28 AM
  • For that you might try over here.

    https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?forum=windowsgeneraldevelopmentissues%2Cwindowssecurity&filter=alltypes&sort=lastpostdesc

     

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    • Marked as answer by Alan Rutter Thursday, June 11, 2015 1:11 AM
    Thursday, June 11, 2015 12:49 AM
    Moderator
  • I have asked my question over at that forum. Thank you.
    Thursday, June 11, 2015 1:10 AM
  • Sounds good. Hope you get some replies.

     

     


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

    Thursday, June 11, 2015 1:18 AM
    Moderator