Skip to content
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

Why does "func host start" assume bin? #136

Closed
jaredcnance opened this issue May 15, 2017 · 5 comments
Closed

Why does "func host start" assume bin? #136

jaredcnance opened this issue May 15, 2017 · 5 comments

Comments

@jaredcnance
Copy link
Contributor

It seems that func host start command looks for a function to exist in .\bin\. This is not entirely intuitive, especially since it is not documented (at least as far as I can tell). It would make more sense if the CLI executed in the current directory.

@ahmelsayed
Copy link
Contributor

Not sure what you mean. It doesn't really know anything about a bin folder. What are you trying to do and what are you seeing?

@jaredcnance
Copy link
Contributor Author

jaredcnance commented May 15, 2017

So, if I have the following directory structure:

/app
/app/bin
/app/bin/app.dll
/app/bin/function.json
/app/host.json
/app/function.json

and function.json looks like:

{
  "scriptFile": "app.dll",
  "entryPoint": "App.Main.Run",
  "disabled": false, ...
}

Running func host start in bin (where the dll is located) results in the following response:

[5/15/2017 3:15:59 PM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

However, running func host start from app works. So, originally I thought maybe it was the scriptFile key that was the issue. However, if I remove the function.json file from the root, so that it only exists in bin, I get the same result. This would imply that the host is looking in a bin directory for function.json files

@ahmelsayed
Copy link
Contributor

I see.

The function runtime expects the folder structure to look something like this:

C:.
|   host.json
|
+---Function1
|       function.json
|
\---Function2
       function.json

This is the convention of the file layout. the act of having a folder with a function.json is what makes it a "function".

So When you run func host start it assumes that you have a function called bin.

What's odd is that it should travel up the tree and run in the app root (which ever folder has host.json in it). Which version are you using?

@jaredcnance
Copy link
Contributor Author

jaredcnance commented May 15, 2017

Ah I see and that makes sense

Azure Functions Core Tools (1.0.0-beta.96)
Function Runtime Version: 1.0.10955.0

Based on what you just said, it would appear the issue was that host.json was getting copied to bin. So, it was running in bin as the root dir. Removing host.json from the bin folder allows me to execute func host start from bin

@ahmelsayed
Copy link
Contributor

yep! that explains it :)
I'm glad you were able to figure this out. I'll close this issue than!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 19, 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

2 participants