ASP.NET Core 1.0 EF7 System.Data.SqlClient not found

Today I tried to deploy my asp.net core 1.0 project to my server. I made a FileSystemDeploy in Visual Studio and transfered it to my server. There I want to run the website in a docker container.
I’m using microsoft/aspnet:1.0.0-rc1-update1-coreclr.

Just for testing I started the docker image with the following command:

  • Windows docker build fail when adding files into /etc/my_init.d/
  • How to deal with transactional logs in Fabric8?
  • can't install nvidia-docker - dpkg: dependency problems prevent configuration of nvidia-docker
  • password define for ssh connection into docker container
  • Confused about volumes_from and volumes usage in docker-compose.yml
  • Good strategy for using docker with mongo and data [closed]
  • docker run -it --name JamesWeb -v ~/James/James.Web:/root --net=host microsoft/aspnet:1.0.0-rc1-update1-coreclr
    

    Then I made a dnu restore which worked as expected. After that I started the application with dnu web. No errors so far in the console. When I open the website the start page is also working, but when I try to go to a page, where I’m using the DatabaseContext the I get an error message:

    fail: Microsoft.Data.Entity.Query.Internal.QueryCompiler[1]
      An exception occurred in the database while iterating the results of a query.
      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.
    
      File name: 'System.Data.SqlClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load the specified file.
      File name: 'System.Data.SqlClient'
         at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
         at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
         at Microsoft.Data.Entity.Storage.Internal.SqlServerConnection.CreateDbConnection()
         at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()
         at Microsoft.Data.Entity.Storage.RelationalConnection.Open()
         at Microsoft.Data.Entity.Query.Internal.QueryingEnumerable.Enumerator.MoveNext()
         at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
         at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
         at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
         at lambda_method(Closure , QueryContext )
         at Microsoft.Data.Entity.Query.Internal.QueryCompiler.<>c__DisplayClass18_1`1.<CompileQuery>b__1(QueryContext qc)
    

    I’m using the following connection string for the DBContext:

    "Server=(localdb)\\mssqllocaldb;Database=James-Web;Trusted_Connection=True;MultipleActiveResultSets=true"
    

    Output by running dnx ef database update to apply the migration:

    File name: 'System.Data.SqlClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load the specified file.
    File name: 'System.Data.SqlClient'
       at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
       at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
       at Microsoft.Data.Entity.Storage.Internal.SqlServerConnection.CreateDbConnection()
       at Microsoft.Data.Entity.Internal.LazyRef`1.get_Value()
       at Microsoft.Data.Entity.Migrations.Internal.Migrator.Migrate(String targetMigration)
       at Microsoft.Data.Entity.Design.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
       at Microsoft.Data.Entity.Commands.Program.Executor.Execute(Action action)
    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.
    

    project.json:

    {
      "userSecretsId": "aspnet5-James.Web-9bb7a5b0-c3f5-4309-984f-5c6057584cb5",
      "webroot": "wwwroot",
      "version": "1.0.0-*",
      "compilationOptions": {
        "emitEntryPoint": true
      },
    
      "dependencies": {
        "EntityFramework.Commands": "7.0.0-rc1-final",
        "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
        "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1",
        "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
        "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
        "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
        "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
        "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
        "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
        "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
        "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
        "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
        "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
        "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
        "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
        "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
        "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
        "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
        "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
        "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
        "Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final",
        "Microsoft.AspNet.Authentication.Google": "1.0.0-rc1-final"
      },
    
      "frameworks": {
        "dnx451": {
          "frameworkAssemblies": {
            "System.IO.Compression": "4.0.0.0",
            "System.IO.Compression.FileSystem": "4.0.0.0"
          }
        },
        "dnxcore50": {
          "dependencies": {
            "System.IO.Compression.ZipFile": "4.0.1-beta-23516"
          }
        }
      },
    
      "commands": {
        "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000",
        "ef": "EntityFramework.Commands"
      },
    
      "exclude": [
        "wwwroot",
        "node_modules"
      ],
      "publishExclude": [
        "**.user",
        "**.vspscc"
      ],
      "scripts": {
        "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
      }
    }
    

  • How to upload docker container logs from TRAVIS CI to remote machine?
  • Git push hang in there
  • It's possible to add an interface to a Docker container for speed up connectivity?
  • Using Ansible docker_service module to deploy service to swarm
  • Can't set custom configuration file for mysql docker container
  • how do i add a topic to a running kafka container using docker commands?
  • One Solution collect form web for “ASP.NET Core 1.0 EF7 System.Data.SqlClient not found”

    This is a known issue in RC1 in the way DNX prepares an application for publication. As far as I know, there is no workaround for RC1. This should be fixed in RC2. See https://github.com/aspnet/dnx/issues/3316 and https://github.com/dotnet/cli/issues/881

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.