locked
Asp.net 5 in Docker with Entity framework 7 for Microsoft SQL server RRS feed

  • Question

  • User1607666731 posted

    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:

    microsoft/aspnet:1.0.0-rc1-update1-coreclr

    Here is my dockerfile:

    FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr

    COPY project.json /app/

    WORKDIR /app

    RUN ["dnu", "restore"]

    COPY . /app

    ARG CONTAINER_PORT=5000

    ARG SERVER_URLS=http://*:$CONTAINER_PORT

    ENV SERVER.URLS $SERVER_URLS

    EXPOSE $CONTAINER_PORT

    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?

    Thanks.

    Thursday, April 7, 2016 9:47 AM

Answers