Runtime Exception on Azure Functions with Entity Framework
See original GitHub issueHi, Team.
I’ve got an issue with running Azure Functions that references to EntityFramework. Here’s my SO Question:
http://stackoverflow.com/questions/40671391/azure-functions-with-entity-framework
I referenced an external assembly that are working perfectly fine on my existing application. This is actual implementation of EntityFramework for my database. When you have a look at the SO question above, I provided the complete code, project.json
, and exception log details. Of course I copied the external assembly into the bin
directory.
Can anyone have a look, please?
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Unable to load Entity Framework Core into C# azure function
Private.CoreLib: Exception while executing function: Function1. FunctionApp1: Could not load file or assembly 'Microsoft.EntityFrameworkCore, ...
Read more >Troubleshoot error: Azure Functions Runtime is unreachable
This issue occurs when the Functions runtime can't start. The most common reason for this is that the function app has lost access...
Read more >Guide for running C# Azure Functions in an isolated worker ...
Learn how to use a .NET isolated worker process to run your C# functions in Azure, which supports non-LTS versions of .NET and...
Read more >Handling errors in Durable Functions (Azure Functions)
Any exception that is thrown in an activity function is marshaled back to the orchestrator function and thrown as a FunctionFailedException .
Read more >Durable entities - Azure Functions
Learn what durable entities are and how to use them in the Durable Functions extension for Azure Functions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@govindsyadv - thanks, that works! So I assumed that by adding the Entity Framework package to the nuget file in my Functions project it would be enough for my satellite assembly to pick it up. But it isn’t, I need to copy the EF dll and all the other dll’s my satellite needs for operation. So I just greated a gulp file to copy all of them into the bin folder for my function.
Hopefully references will be something coming soon in the tooling.
Hi ,
I am using the EF6 and it is working successfully . Apart from efconnection builder , you also need to copy the ef6 dll in the shared/bin folder and refer the dll / import in your csx file .
These are the snippets of my working code .
public MYDBContext() : base(GetConnectionString()) { }
here the connection string is set in application settings .
on csx part
using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Data.Entity.Core.Objects; using System.Data.Entity.ModelConfiguration.Conventions;
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Net; using System.Configuration; using System.IO; using System.Net.Mail;
using Newtonsoft.Json.Linq; using Newtonsoft.Json;
public static void Run(string myQueueItem, TraceWriter log) {
//MYDBcontext is being set in application settings on azurefunctions with the connectionstring as value log.Info(GetConnectionStringVariable(“MYDBContext”)); } catch (System.Exception ex) { log.Info($“Error Occured : {ex}”); throw ex; }
}
public static string GetConnectionStringVariable(string name) {
}
and in the shared folder place these two dlls EntityFramework.dll EntityFramework.SqlServer.dll
Thanks