InvalidOperationException

leonardoAlves's Avatar

leonardoAlves

21 May, 2016 03:55 PM

Well, I'm a little bit noob at this but let's go, I'm trying to use sql server in my application (Using EF6 CodeFirst) and I'm getting the following error:
[InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.]

I have already tried to change my connection for the one that sql server inject in my web.config but no sucess, if someone have the same issue and could give some help.

my connection string:

 <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="MARYKEY" connectionString="Server=afe91a8c-d961-40c9-8343-a60b0156b0b2.sqlserver.sequelizer.com;Database=dbafe91a8cd96140c98343a60b0156b0b2;User ID=[USERFROMSQL];Password=[PASSWORDFROMSQL];" providerName="System.Data.SqlClient" />
  </connectionStrings>
  1. Support Staff 1 Posted by rune on 23 May, 2016 06:55 AM

    rune's Avatar

    Hi,

    I took a look at the application, and the exception doesn't seem to have occurred since you most recent deployment (at least according to the application's "Errors" page) -- did that fix the issue or are you somehow handling the exception now? If you're still experiencing this issue it'd be great if you could provide steps to reproduce/test it.

    Best,
    Rune

  2. 2 Posted by leonardoAlves on 23 May, 2016 07:33 PM

    leonardoAlves's Avatar

    Hi, i didn't fix the issue, i don't have any issue running the web app by visual studio, but I'm trying to find some help in other forums too (stackoverflow), but with no success till now, if you saw something wrong at the code and could give me some light, I'd be very thankful.
    thank for your attention,Leonardo Alves

  3. Support Staff 3 Posted by rune on 24 May, 2016 12:10 AM

    rune's Avatar

    Ok got it -- it sounds a lot like the issue you're experiencing is similar to this one. The SqlProvider binary also doesn't appear in your build logs, so that might explain the difference as the file might be available to your application when running it locally.

    You might want to try and clean your repository for any uncommitted changes and files (git clean -fdx will do that) to verify if that's the case. If it is I suspect you just need to try one of the solutions proposed in the Stack Overflow thread -- the necessary file likely needs to be explicitly configured to copy the required Sql provider assembly to the output directory. Particularly this blog post might be helpful to fix this.

    Best,
    Rune

  4. 4 Posted by leonardoAlves on 27 May, 2016 11:25 PM

    leonardoAlves's Avatar

    Hey! thank for the help. I've solved the problem, sounds like something wasn't being copied but the System.Data.Entity.SqlServer.SqlProviderServices.Instance; could solve the problem, now I'm getting another error but i'll try to fix it when i have some time. Anyway thanks for the attention.Best regards,Leonardo

  5. Support Staff 5 Posted by rune on 28 May, 2016 01:46 AM

    rune's Avatar

    Hi Leonardo,

    OK great, good to hear you were able to fix the initial issue. Let me know if there's anything else I can help with.

    Best,
    Rune

  6. rune closed this discussion on 28 May, 2016 01:46 AM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac