Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Webjob failing Exit Code -1073740940

Tags:

c#

file-io

azure

I have written a c# console app which I've deployed to an Azure Webjob. The app runs fine locally but on Azure I get the error:

[09/16/2015 10:40:35 > 998fb8: SYS ERR ] Job failed due to exit code -1073740940

I think I've tracked it down to accessing a certificate file. I have added it to a Resources.resx in the project's properties and I'm accessing the cert with the following (also the line it's failing on)

X509Certificate2 _certificate = new X509Certificate2(echoService.Properties.Resources.public_privatekey, ConfigurationManager.AppSettings["certPsw"]);

Is this the correct way, or is there a better way. I've tried using a relative path in AppSettings but failed with this as well.

As a side note, I have put the plain text password in AppSettings for now but will handle this better when my concept is proven. Is there a discussion on how to store passwords like this, and whether the certificate should be created without a password?

like image 679
Chris Crawshaw Avatar asked Oct 20 '22 02:10

Chris Crawshaw


1 Answers

I found that Azure copies the files to a temporary location to get around locking of files for a continuous job. Apparently the resource files aren't copied with it.

However for certificates I can reference them using the following tutorial and all is now working http://azure.microsoft.com/en-us/blog/using-certificates-in-azure-websites-applications/

like image 135
Chris Crawshaw Avatar answered Oct 21 '22 17:10

Chris Crawshaw