Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP.NET 5/EF 7: Could not load file or assembly 'System.Data.SqlClient' #3905

Closed
f0rt opened this issue Nov 26, 2015 · 7 comments
Closed

ASP.NET 5/EF 7: Could not load file or assembly 'System.Data.SqlClient' #3905

f0rt opened this issue Nov 26, 2015 · 7 comments

Comments

@f0rt
Copy link

f0rt commented Nov 26, 2015

Hi team,

I'm deploying ASP.NET 5 application to Azure. After successful deploy and opening my site in the browser I'm getting the error:
FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I had similar issue using ASP.NET 4 explained here: http://stackoverflow.com/questions/21641435/error-no-entity-framework-provider-found-for-the-ado-net-provider-with-invarian
The solution named "the terrible hack" worked for me then. :)

Do you have any ideas what might be causing the problem and how to fix it?

Thanks in advance!

@f0rt
Copy link
Author

f0rt commented Nov 27, 2015

System.Data.SqlClient is referenced in my project by EntityFramework.MicrosoftSqlServer. I've added direct dependency in project.json. My guess was that the dependency is not downloaded/deployed because it is not directly referenced. It failed again with the same error. I've added some code in startup.cs to prevent any deployment optimization (if exists) and the application crashed with "An error occurred while starting the application.".

@Sebazzz
Copy link

Sebazzz commented Nov 28, 2015

Having the same issue here in my application.

Sebazzz added a commit to Sebazzz/financial-app that referenced this issue Nov 28, 2015
@Sebazzz
Copy link

Sebazzz commented Nov 28, 2015

This appears to be a duplicate of #3637.

@Sebazzz
Copy link

Sebazzz commented Nov 28, 2015

It appears that the real issue is a dependency problem of SqlClient which is being tracked in dotnet/corefx as #3760. Not sure what solution is possible in the mean time.

@f0rt
Copy link
Author

f0rt commented Nov 28, 2015

It is strange but I have a dnx50 azure web job that is working with the same code. Glad to hear they're already working on that though. Thanks for the reply.

@Sebazzz
Copy link

Sebazzz commented Nov 29, 2015

That's odd.

I've just created a fresh VM on Azure with Ubuntu and I'm still having the issue:

System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
       ---> System.IO.FileNotFoundException: Could not load the specified file.
         at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
         at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)

Fixed that via #3689

@rowanmiller
Copy link
Contributor

Closing as this is a dupe of #3637... which is actually an issue in DNX (a fix is being worked on at the moment).

https://github.com/dotnet/corefx/issues/3760 is actually a different issue which results in an exception about not being able to load the native assemblies (rather than System.Data.SqlClient).

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants