0

I have created an azure function in c sharp. a post api and i use Postman , it works perfectly fine. To get the database edmx to work (Add New -> ADO New Entity Model) - i have had to create a new project within my Azure function solution to store my edmx. All this works fine. I can do a simple POST API call in Postman and it updates the database - easy. I just added a reference between my azure function project and the edmx project.

When i came to publish the function , it didn't work. Does anyone know if the reference would be kept when i publish it to the azure service ? Also i cannot find decent logging on the azure portal.

And all i got in postman was :

{ "id": "40ed4254-21f9-4514-afdd-8a19facd569e", "requestId": "557e772e-a9a1-4922-b29a-8888529f0d02", "statusCode": 500, "errorCode": 0, "message": "An error has occurred. For more information, please check the logs for error ID 40ed4254-21f9-4514-afdd-8a19facd569e" }

Is it possilbe to add the edmx (ADO Entity framework - Add new) in the azure project ? Because when i did all i got was :

enter image description here

Jason_Hough
  • 392
  • 5
  • 31

1 Answers1

0

Yes, the references will be added to the azure service while publishing. You can check it from Advanced tools from left Pane -> Go -> Kudu Console -> site -> bin. From there you can see all the references that are added to the project.

enter image description here enter image description here

Usually, the error Object reference not set to an instance of an object occurs when you are trying to access a member of a class instance using a null reference. As you are referencing it from the portal the instance is pointing to a null reference and hence you are getting that error. Also, there is a Concept called ReDistribution functions that can help with adding references to azure functions in the portal by zipping the contents and uploading them to our azure function from the portal through Kudu Console.

One of the workarounds is to try to connect your database to azure DB. Also I can see the status code to be 500 (which can be caused by many reasons i.e. 1. Generic Error, 2. Server Down, 3. Internal Server Error), which means that there is a server-side error and not the client-side (Example: Api is getting hit but there is no way we are getting the response).

For more information, you can refer HERE and also these SO Threads Thread1 Thread2 which discusses similar topic.

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18