Skip to content

ASP.NET 5 Console Application as Azure WebJob #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
djanosik opened this issue Feb 25, 2015 · 8 comments
Closed

ASP.NET 5 Console Application as Azure WebJob #338

djanosik opened this issue Feb 25, 2015 · 8 comments

Comments

@djanosik
Copy link

Hi,

what do I need to publish ASP.NET 5 Console Application as an Azure WebJob? AFAIK there is no executable I can use to run the application.

Thank you!

@victorhurdugaci
Copy link
Contributor

Bundle the application using kpm bundle --runtime <runtime>, zip the output folder and deploy it as webjob.

@Eilon
Copy link
Contributor

Eilon commented Feb 25, 2015

There is no direct executable, but when you use kpm bundle it'll generated CMD file for whichever commands were registered in the project.json file, such as run --> run.cmd.

@djanosik
Copy link
Author

Thank you! I am able to deploy the web job, but it fails with this error message.

[03/18/2015 21:11:50 > 21031f: SYS INFO] Status changed to Initializing
[03/18/2015 21:11:52 > 21031f: SYS INFO] Run script 'WebJob.cmd' with script host - 'WindowsScriptHost'
[03/18/2015 21:11:52 > 21031f: SYS INFO] Status changed to Running
[03/18/2015 21:11:52 > 21031f: ERR ] '"klr.exe"' is not recognized as an internal or external command,
[03/18/2015 21:11:52 > 21031f: ERR ] operable program or batch file.
[03/18/2015 21:11:52 > 21031f: SYS INFO] Status changed to Failed
[03/18/2015 21:11:52 > 21031f: SYS ERR ] Job failed due to exit code 1

@victorhurdugaci
Copy link
Contributor

You have to bundle the application with the runtime (like I showed above). Otherwise it will not work

@djanosik
Copy link
Author

Great, it works now. Thank you!

@mburumaxwell
Copy link

Hi,
I have a problem when I try to use the webjobs sdk with a console application.
The code:

var jobconfig = new JobHostConfiguration("key here");
var host = new JobHost(jobconfig);
host.RunAndBlock();

It fails in the first line with the following error:

An exception of type 'System.IO.FileLoadException' occurred in Microsoft.Azure.WebJobs.Host.dll but was not handled in user code
Additional information: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Checking further I get this

A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

The Stack Trace is:

   at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageCredentialsValidator..ctor()
   at Microsoft.Azure.WebJobs.Host.Executors.DefaultStorageAccountProvider..ctor()
   at Microsoft.Azure.WebJobs.JobHostConfiguration..ctor(String dashboardAndStorageConnectionString)
   at TestWebJob.Program.Main(String[] args) in C:\Users\Me\Documents\TestWebJob\Program.cs:line 20

After reading through some issues, I realized I should sign the output. I tried two options as below but none worked on the Console App:
Option 1:

"compilationOptions": {
    "keyFile": "TestWebJob.snk"
  }

Option 2:

"compilationOptions": {
    "strongName": true
  }

Anyone have a solution or workaround?
Thanks in advance

@Eilon
Copy link
Contributor

Eilon commented Sep 8, 2015

Looks like you logged this here: Azure/azure-webjobs-sdk#566

@mburumaxwell
Copy link

yes I did so

ryanbrandenburg pushed a commit that referenced this issue Nov 19, 2018
natemcmaster referenced this issue Nov 30, 2018
Reference `Entropy` localization samples
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants