Azure Function: Microsoft.WindowsAzure.Storage assembly not found - azure

[15/03/2018 11:03:14 PM] Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=8.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)
[15/03/2018 11:03:14 PM] at Tux.Workers.RollCall.Azure.AzureTable.<Init>d__1.MoveNext()
[15/03/2018 11:03:14 PM] at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
[15/03/2018 11:03:14 PM] at Tux.Workers.RollCall.Azure.AzureTable.Init(String tableName)
[15/03/2018 11:03:14 PM] at Tux.Workers.RollCall.Function1.<Run>d__0.MoveNext()
[15/03/2018 11:03:14 PM] Function completed (Success, Id=438dae86-18a8-4c85-b121-3918e2307ca4, Duration=122ms)
[15/03/2018 11:03:14 PM] Executed 'Function1' (Succeeded, Id=438dae86-18a8-4c85-b121-3918e2307ca4)
No matter how I do this error always occur whenever trying to calling Cloud Service in Azure function project. I can see the Microsoft.WindowsAzure.Storage.dll file in the bin directory inside the project. I also see the dll inside
C:\Users\klam0\.nuget\packages\windowsazure.storage\8.6.0
When I create a basic console application, I have no problem calling the Cloud to get the table reference.
Do I need to configure something on the portal if I just run the project locally?

Related

Using blobTrigger with Azurite crashes function host

I'm running into a problem with a Azure blob triggered function crashing the function host. It seems to be an issue with the storage connection string or how I'm using Azurite. Other timer or HTTP trigger functions I'm working on work fine with the "UseDevelopmentStorage=true" setting and the Azurite blob service running.
I'm rather stumped as to what the issue could be with getting a blob trigger function to work in my dev environment using the Azurite storage emulator.
Any suggests about what I'm missing or where to look futher?
This is the error message I get about 10 to 20 seconds after the function host starts:
An unhandled exception has occurred. Host is shutting down.
Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. System.Net.Http: No connection could be made because the target machine actively refused it. System.Private.CoreLib: No connection could be made because the target machine actively refused it.
The function.json file for the blob trigger function looks like this:
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "myblob",
"type": "blobTrigger",
"direction": "in",
"path": "outcontainer/{name}",
"connection": "AzureWebJobsStorage"
}
]
}
The local.settings.json file has this:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
This is the output from console with the --verbose switch enabled:
[9/23/2020 6:28:36 PM] Job host started
Functions:
BlobTrigger1: blobTrigger
Hosting environment: Production
Content root path: C:\sources\AzureBlobTriggerTest
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Starting Azure Functions Python Worker.
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Worker ID: d4160c17-a9f0-461d-af04-18623c45a51b, Request ID: fdf8841e-8564-4f4e-a983-91553451cd9d, Host Address: 127.0.0.1:51168
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Successfully opened gRPC channel to 127.0.0.1:51168
[9/23/2020 6:28:37 PM] LanguageWorkerConsoleLog INFO: Detaching console logging.
[9/23/2020 6:28:37 PM] Switched to gRPC logging.
[9/23/2020 6:28:37 PM] Received WorkerInitRequest, request ID fdf8841e-8564-4f4e-a983-91553451cd9d
[9/23/2020 6:28:37 PM] Worker process started and initialized.
[9/23/2020 6:28:37 PM] Received FunctionLoadRequest, request ID: fdf8841e-8564-4f4e-a983-91553451cd9d, function ID: dc522140-aa0a-453b-8767-4aedf88435e4
[9/23/2020 6:28:37 PM] Successfully processed FunctionLoadRequest, request ID: fdf8841e-8564-4f4e-a983-91553451cd9d, function ID: dc522140-aa0a-453b-8767-4aedf88435e4
[9/23/2020 6:28:41 PM] Host lock lease acquired by instance ID '0000000000000000000000002B956994'.
[9/23/2020 6:29:09 PM] An unhandled exception has occurred. Host is shutting down.
[9/23/2020 6:29:09 PM] Microsoft.WindowsAzure.Storage: No connection could be made because the target machine actively refused it. System.Net.Http: No connection could be made because the target machine actively refused it. System.Private.CoreLib: No connection could be made because the target machine actively refused it.
[9/23/2020 6:29:09 PM] Stopping host...
[9/23/2020 6:29:09 PM] Stopping JobHost
[9/23/2020 6:29:09 PM] Stopping the listener 'Microsoft.Azure.WebJobs.Host.Listeners.CompositeListener' for function 'BlobTrigger1'
[9/23/2020 6:29:09 PM] Stopped the listener 'Microsoft.Azure.WebJobs.Host.Listeners.CompositeListener' for function 'BlobTrigger1'
[9/23/2020 6:29:09 PM] Job host stopped
[9/23/2020 6:29:09 PM] Host shutdown completed.
Looks like I found what I was doing wrong. The documentation says, "The Azure Blob storage trigger requires a general-purpose storage account."
I was only starting the Azurite blob service. Starting the whole thing gets it working.
To run a Node blobTrigger locally you need to:
Make sure you are running Node 8 or 10. I run 10.14.1
Change local.settings.json:
"AzureWebJobsStorage": "UseDevelopmentStorage=true"
Run azurite with all services. Not only BlobStorage.

CloudQueueMessage QueueTrigger in Azure vs Local Instance

I need to be able to get to the queue item itself (not the string), so that I can manipulate it from my function.
In run.csx code blelow runs and i get access to CloudQueueMessage
#r "Microsoft.WindowsAzure.Storage"
using Microsoft.WindowsAzure.Storage.Queue;
using System;
public static void Run(CloudQueueMessage myQueueItem, ILogger log)
{
log.LogInformation($"Queue ID: {myQueueItem.Id}");
log.LogInformation($"Queue Insertion Time: {myQueueItem.InsertionTime}");
log.LogInformation($"Queue Expiration Time: {myQueueItem.ExpirationTime}");
log.LogInformation($"Queue Payload: {myQueueItem.AsString}");
}
In my local development this code throws an error.
I use all latest Nuget's.
VS2017 15.8.8
Azure Function and Web Job Tools: 15.10.2046.0
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage.Queue;
namespace AzurePumps.MyForce
{
public static class PersonQueueProcessor
{
[FunctionName("PersonQueueProcessor")]
public static void Run([QueueTrigger("sfcontact-update-error", Connection = "storage-queue-connection")]CloudQueueMessage myQueueItem, ILogger log)
{
log.LogInformation($"Queue ID: {myQueueItem.Id}");
log.LogInformation($"Queue Insertion Time: {myQueueItem.InsertionTime}");
log.LogInformation($"Queue Expiration Time: {myQueueItem.ExpirationTime}");
log.LogInformation($"Queue Payload: {myQueueItem.AsString}");
}
}
}
Log:
Azure Functions Core Tools (2.1.748 Commit hash: 5db20665cf0c11bedaffc96d81c9baef7456acb3)
Function Runtime Version: 2.0.12134.0
Skipping 'SF_SecurityToken' from local settings as it's already defined in current environment variables.
[10/26/2018 8:07:51 PM] Building host: startup suppressed:False, configuration suppressed: False
[10/26/2018 8:07:52 PM] Reading host configuration file 'D:\Projects\Force\bin\Debug\netstandard2.0\host.json'
[10/26/2018 8:07:52 PM] Host configuration file read:
[10/26/2018 8:07:52 PM] {
[10/26/2018 8:07:52 PM] "version": "2.0"
[10/26/2018 8:07:52 PM] }
[10/26/2018 8:07:53 PM] Initializing Host.
[10/26/2018 8:07:53 PM] Host initialization: ConsecutiveErrors=0, StartupCount=1
[10/26/2018 8:07:53 PM] Starting JobHost
[10/26/2018 8:07:53 PM] Starting Host (HostId=vddk35x1fmsnlt-1608145051, InstanceId=e9842cc2-f4a1-46c2-80d0-3e0aad9ae83b, Version=2.0.12134.0, ProcessId=16720, AppDomainId=1, Debug=False, FunctionsExtensionVersion=)
[10/26/2018 8:07:53 PM] Loading functions metadata
[10/26/2018 8:07:53 PM] 2 functions loaded
[10/26/2018 8:07:54 PM] Generating 2 job function(s)
[10/26/2018 8:07:55 PM] Found the following functions:
[10/26/2018 8:07:55 PM] AzurePumps.MyForce.PersonProcessor.Run
[10/26/2018 8:07:55 PM] AzurePumps.MyForce.PersonQueueProcessor.Run
[10/26/2018 8:07:55 PM]
[10/26/2018 8:07:55 PM] Host initialized (1859ms)
[10/26/2018 8:08:00 PM] Host started (6876ms)
[10/26/2018 8:08:00 PM] Job host started
Hosting environment: Production
Content root path: D:\Projects\Force\bin\Debug\netstandard2.0
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Listening on http://0.0.0.0:7071/
Hit CTRL-C to exit...
[10/26/2018 8:08:06 PM] Host lock lease acquired by instance ID '0000000000000000000000006DB263D8'.
[10/26/2018 8:08:22 PM] Executing 'PersonQueueProcessor' (Reason='New queue message detected on 'sfcontact-update-error'.', Id=1e37d3a4-a992-41c8-b6ca-595787e5224e)
[10/26/2018 8:08:23 PM] Executed 'PersonQueueProcessor' (Failed, Id=1e37d3a4-a992-41c8-b6ca-595787e5224e)
**[10/26/2018 8:08:23 PM] System.Private.CoreLib: Exception while executing function: PersonQueueProcessor. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'myQueueItem'. Microsoft.Azure.WebJobs.Extensions.Storage: Binding parameters to complex objects (such as 'CloudQueueMessage') uses Json.NET serialization.
1. Bind the parameter type as 'string' instead of 'CloudQueueMessage' to get the raw values and avoid JSON deserialization, or
2. Change the queue payload to be valid json. The JSON parser failed: Unexpected character encountered while parsing value: i. Path '', line 0, position 0.**
Make sure you don't reference/install WindowsAzure.Storage latest version 9.3.2, there seems a bug when integrating with Function SDK. See the issue tracked.
Right now when we create a v2 Function Project, the dependencies in the template, e.g. Microsoft.NET.SDK.Functions references WindowsAzure.Storage 9.3.1 by default. This version works well(as you have seen in Azure portal), no need to install the package separately.
Besides, recommend you to update Microsoft.Azure.WebJobs.Extensions.Storage to 3.0.1 to avoid some first chance exception throwing.

VS 2017 for Mac Azure Function Unable to configure java worker. Could not find JAVA_HOME app setting

I am in the process of creating an Azure Function Apps project. I get
the following error when running the server.
Hosting environment: Production
Content root path:
/Users/dentonsavage/Projects/AzureFunctionTest/AzureFunctionTest/bin/Debug/netstandard2.0
Now listening on: http://localhost:7071 Application started. Press Ctrl+C to shut down.
[7/9/18 9:48:39 PM] Reading host configuration file '/Users/dentonsavage/Projects/AzureFunctionTest/AzureFunctionTest/bin/Debug/netstandard2.0/host.json'
[7/9/18 9:48:39 PM] Host configuration file read:{}
[7/9/18 9:48:39 PM] Starting Host (HostId=shoufu-1532713004, InstanceId=9869d715-4618-48f0-b0d1-16c4fea66dba, Version=2.0.11651.0, ProcessId=43170, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)
[7/9/18 9:48:40 PM] Unable to configure java worker. Could not find JAVA_HOME app setting.
[7/9/18 9:48:40 PM] Could not configure language worker Java.
[7/9/18 9:48:41 PM] Generating 1 job function(s)
[7/9/18 9:48:41 PM] Found the following functions:
[7/9/18 9:48:41 PM] AzureFunctionTest.HttpTrigger.Run
[7/9/18 9:48:41 PM] Host initialized (2120ms) Listening on
http://localhost:7071/ Hit CTRL-C to exit...
Http Functions:
HttpTrigger: http://localhost:7071/api/HttpTrigger
[7/9/18 9:48:43 PM] Host started (3920ms)
[7/9/18 9:48:43 PM] Job host started
[7/9/18 9:48:44 PM] Host lock lease acquired by instance ID '000000000000000000000000C475F100'.
Does anyone know how I can solve this issue? Thank you.
Actually it's not an error. It's just a tip reminding us there's no JAVA_HOME configuration in your system environment variables.
It was used for java development before but has been proved unnecessary and removed in new version Azure Function core tools. See this issue.
So you can just ignore this harmless tip or install latest version function core tools to get rid of it.
Installation Steps:
Install .NET Core for macOS.
Install Homebrew, if it's not already installed.
Install the Core Tools package using bash:
brew tap azure/functions
brew install azure-functions-core-tools
After that navigate to Content root path:
/Users/dentonsavage/Projects/AzureFunctionTest/AzureFunctionTest/bin/Debug/netstandard2.0
Then input func start in bash to debug your project.

Azure Functions 1.0.7 giving Could not load file or assembly error with EF Core 2

I'm trying to move some functionality to Azure Functions. Created a project for EF Core 2 code, and referenced it to the Azure Functions project. Added the EF Core+SQLServer nugget packages to the Azure Functions project. When the function attempts to execute, this is the errors in the screen. I can see that the Microsoft.EntityFrameworkCore assembly is in the same directory as our azure functions dll.
Can anyone shed some light on why it's not finding it and how to fix this?
[1/3/2018 6:49:56 AM] A ScriptHost error has occurred
[1/3/2018 6:49:56 AM] Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[1/3/2018 6:49:56 AM] Exception while executing function: Accounting
[1/3/2018 6:49:56 AM] Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[1/3/2018 6:49:56 AM] Function completed (Failure, Id=56ba500b-7c3a-45c1-a9eb-8be4d52d1592, Duration=159ms)
[1/3/2018 6:49:56 AM]
[1/3/2018 6:49:56 AM] Executed 'Accounting' (Failed, Id=56ba500b-7c3a-45c1-a9eb-8be4d52d1592)
[1/3/2018 6:49:56 AM] System.Private.CoreLib: Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[1/3/2018 6:49:56 AM] Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '56ba500b-7c3a-45c1-a9eb-8be4d52d1592'
[1/3/2018 6:49:56 AM] System.Private.CoreLib: Exception while executing function: Accounting. AS.Jobs: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Update: 1/3/2018
I have VS 2017 15.5.2 installed, and I am building this in VS.
Here is the output of the function host when I run it from VS.
[1/4/2018 3:47:03 AM] Host configuration file read:
[1/4/2018 3:47:03 AM] {
[1/4/2018 3:47:03 AM] }
[1/4/2018 3:47:04 AM] Generating 1 job function(s)
[1/4/2018 3:47:04 AM] Starting Host (HostId=jlt03-962556955, Version=2.0.11353.0, ProcessId=21200, Debug=False, Attempt=0, FunctionsExtensionVersion=)
[1/4/2018 3:47:04 AM] Found the following functions:
[1/4/2018 3:47:04 AM] Jobs.Accounting.Run
[1/4/2018 3:47:04 AM]
Listening on http://localhost:7071/
So after much much more searching, I came across this GitHub posted issue. It is the exact same issue that I am seeing here. Apparently it is a issue with Azure Functions 1.0.7 and EF Core 2.0.1.
I had to role back AF back to 1.0.6 AND I also had to role EF Core back to 2.0.0. Afterwards the function executed as expected.
I will be monitoring the GitHub issue and update this answer once it is confirmed to be fixed.
Update
This is now fixed with Azure Functions Core Tools 2.1.0 release.
https://github.com/Azure/app-service-announcements/issues/109
what worked for me was to delete all folders under bin folder and build the app!!

Instantiation of class in BPEL process

I have a very Strange problem, in my BPEL process I have used java embed Activity. on that activity if I am using Task class. then I am not able to deploy my process. its giving me following message.
when I remove that line then I am able to deploy that process.
following error comes when deployment.
[10:29:41 AM] ---- Deployment
started. ---- [10:29:41 AM] Target
platform is (Weblogic 10.3).
[10:29:41 AM] Running dependency
analysis... [10:29:41 AM] Building...
[10:29:52 AM] Deploying profile...
[10:30:19 AM] Wrote Archive Module to
D:\RegistrationUpload\RegistrationUpload\RegistrationUpload\deploy\sca_RegistrationUpload_rev21.0.jar
[10:30:19 AM] Deploying
sca_RegistrationUpload_rev21.0.jar to
partition "default" on server
soa_server1
[WIN-73I7I7QL8Z3.uradevt.gov.sg:8002]
[10:30:19 AM] Processing
sar=/D:/RegistrationUpload/RegistrationUpload/RegistrationUpload/deploy/sca_RegistrationUpload_rev21.0.jar
[10:30:19 AM] Adding sar file -
D:\RegistrationUpload\RegistrationUpload\RegistrationUpload\deploy\sca_RegistrationUpload_rev21.0.jar
[10:30:19 AM] Preparing to send HTTP
request for deployment [10:30:19 AM]
Creating HTTPS connection to
host:WIN-73I7I7QL8Z3.uradevt.gov.sg,
port:8002 [10:30:19 AM] Sending
internal deployment descriptor
[10:30:20 AM] Sending archive -
sca_RegistrationUpload_rev21.0.jar
[10:33:45 AM] Received HTTP response
from the server, response code=500
[10:33:45 AM] Error deploying archive
sca_RegistrationUpload_rev21.0.jar to
partition "default" on server
soa_server1
[WIN-73I7I7QL8Z3.uradevt.gov.sg:8002]
[10:33:45 AM] HTTP error code returned
[500] [10:33:45 AM] Error message from
server: Error during deployment: Error
occurred during deployment of
component: OfficerList to service
engine: implementation.bpel, for
composite: RegistrationUpload:
ORABPEL-01005
Failed to compile bpel generated
classes. failure to compile the
generated BPEL classes for BPEL
process "OfficerList" of composite
"default/RegistrationUpload!21.0*soa_27af417b-20d6-48d0-821c-4f26b3c4ce94" The class path setting is incorrect.
Ensure that the class path is set
correctly. If this happens on the
server side, verify that the custom
classes or jars which this BPEL
process is depending on are deployed
correctly. Also verify that the run
time is using the same
release/version. . [10:33:45 AM]
Check server log for more details.
[10:33:45 AM] Error deploying archive
sca_RegistrationUpload_rev21.0.jar to
partition "default" on server
soa_server1
[WIN-73I7I7QL8Z3.uradevt.gov.sg:8002]
[10:33:45 AM] #### Deployment
incomplete. #### [10:33:45 AM] Error
deploying archive
file:/D:/RegistrationUpload/RegistrationUpload/RegistrationUpload/deploy/sca_RegistrationUpload_rev21.0.jar
(oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)
follwing code I have used in snippet.
<bpelx:exec import="org.w3c.dom.Element"/>
<bpelx:exec import="com.ura.dams.workflow.process.OfficerList"/>
<bpelx:exec import="oracle.bpel.services.workflow.task.model.Task"/>
<bpelx:exec name="getTaskInfoForPO" version="1.5" language="java">
<![CDATA[try
{
OfficerList officerlist= new OfficerList();
String JobAssignmentType1= (String)getVariableData("JobAssignmentType");
String officerLevel1= (String)getVariableData("officerLevel");
String applicationType1= (String)getVariableData("applicationType");
String functionId1= (String)getVariableData("functionId");
String dcConservationFlag1= (String)getVariableData("dcConservationFlag");
String app_id_key1= (String)getVariableData("app_id_key");
String app_id_value1= (String)getVariableData("app_id_value");
String taskID1= (String)getVariableData("taskID");
String officer="";
String DConservatiionFlag="";
java.util.Hashtable keyValues= new java.util.Hashtable();
keyValues.put(app_id_key1, app_id_value1);
Task taskinfo= null;
}
catch(Exception e)
{
System.out.println("error occured" + e);
}]]>
</bpelx:exec>
Will anyone please tell me do I need to refer jar file in terms of BPEL process also.
even same class I can use in my java files in the same project. (for other class its working like OfficerList)
Environment is : Oracle SOA 11g, Jdeveloper
please suggest something.
I am suspecting that the IMPORT statements does not work. Most of the time I do import, but turn around and use the full package/class name for it. Have you try using the full package/class as follow?
com.ura.dams.workflow.process.OfficerList officerlist=
new com.ura.dams.workflow.process.OfficerList();
...
oracle.bpel.services.workflow.task.model.Task taskinfo= null;

Resources