Entity framework 7 with Microsoft SQL server not working in Docker
I am using EntityFramework 7 with Microsoft SQL server in asp.net 5. I am using EntityFramework.MicrosoftSqlServer: 7.0.0-rc1-final.
When I run my web application in visual studio everything it works as expected.
But, I want to run my application in Docker. I am using official Docker image for running asp.net application:
Here is my dockerfile:
COPY project.json /app/
RUN [“dnu“, “restore”]
COPY . /app
ENV SERVER.URLS $SERVER_URLS
ENTRYPOINT [“dnx”, “-p”, “project.json”, “web”]
Build is successful in docker, but when I run application I get following error after application starts:
Application startup exception: System.IO.FileLoadException: Could not load file or assembly ‘app, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
[36mwebapi_1 | [0mFile name: ‘app, Culture=neutral, PublicKeyToken=null’ —> Microsoft.Dnx.Compilation.CSharp.RoslynCompilationException: /app/Startup.cs(33,18): DNXCore,Version=v5.0 error CS1061: ‘EntityFrameworkServicesBuilder’ does not contain a definition for ‘AddSqlServer’ and no extension method ‘AddSqlServer’ accepting a first argument of type ‘EntityFrameworkServicesBuilder’ could be found (are you missing a using directive or an assembly reference?)
The problem seems to be in ‘AddSqlServer’ command. Strange thing is that it works when built and runt from visual studio. Does anyone know something about this problem?
One Solution collect form web for “Entity framework 7 with Microsoft SQL server not working in Docker”
Try explicitly sharing your drive with the Docker host. If you are using docker-machine, this is under the settings for default in Virtual Box. If you have the Docker for Windows beta, you can do it in the settings from the task bar icon. It may not be that the extension method is missing, only that Docker can’t access it.