Search code examples
c#sqlentity-framework-6azure-web-app-service

Error: The FunctionImport 'StoredProcedureName' could not be found in the container 'EntityFileName'. Only after published to app service


I am using a database-first approach to generate models in my project, these models are built from tables in an Azure hosted SQL database.

When I run this on my localhost, I can interact with Entity Framework in all of the ways I would expect, no problems. However, after I publish the application to my Azure App Service, none of my stored procedures or models can be located in the container.

I get errors like:

The FunctionImport 'StoredProcedureName' could not be found in the container 'ContainerName'.

I have verified that the connection string is formatted in the correct manner (it was created by the EF wizard anyway). Besides, this would most likely show an issue when running locally also I assume.

Other things I have tried:

  • Deleting the models and stored procedures and rebuilding them in the .edmx file.
  • Verifying the connection string locally and then in the web.config once up on the AppService.
  • Clearing down the bin folder on the AppService.
  • Restarting the AppService & Visual Studio.

Solution

  • So it turns out in this case, somebody had added a web.config on the App Service settings itself, which was overwriting the one in my websites root directory.

    Removing this rogue entry fixed my problem.