2017-02-24 20 views
1

AzureポータルでAzure-Functionアプリケーションを作成しました。Azure-Functionで実行可能なコンソールアプリケーションを起動する方法

D:\home\site\wwwrootの下には、MyAppというフォルダがあり、その中に実行可能ファイルMy.App.exeがあります。

は、私はまた、このフォルダにrun.ps1 PowerShellスクリプトを持っていると私は単純にPowerShellスクリプトをexeファイルのアプリを起動します。

また、私はこのfunction.jsonを持っている:

{ 
    "bindings": [ 
    { 
     "name": "MyApp", 
     "type": "timerTrigger", 
     "direction": "in", 
     "schedule": "0 */6 * * * *", 
     "runOnStartup": true 
    } 
    ] 
} 

私はexeファイルのアプリケーションを呼び出すためにrun.ps1ファイルに何を置く必要がありますか?

私は& ".\My.App.exe"を試してみましたが、それが与える:

2017-02-24T15:15:47.204 Function started (Id=0f4b9b0b-a1f5-4812-9d93-c4017da5ac1c) 
2017-02-24T15:15:51.562 & : The term '.\My.App.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
at run.ps1: line 1 
+ & 
+ _ 
+ CategoryInfo   : ObjectNotFound: (.\My.App.exe:String) [], CommandNotFoundException 
+ FullyQualifiedErrorId : CommandNotFoundException 

私も".\My.App.exe"を試み、それが与える:

2017-02-24T15:26:29.312 Function started (Id=dced4842-069b-43c6-a055-aa06a46286c4) 
2017-02-24T15:26:29.499 .\My.App.exe 
2017-02-24T15:26:29.499 Function completed (Success, Id=dced4842-069b-43c6-a055-aa06a46286c4) 

をそれの最初の行がConsole.WriteLineあるので、exeファイルが起動されなかったとして、それはですログは、PowerShellのファイルに格納するための正しいコマンドは何ですか?

空でありますか

& 'D:\home\site\wwwroot\MyApp\My.App.exe' 

あなたAzureの機能ファイルは常に下に存在しなければならない:コメント欄での議論パー

答えて

2

は、1つの解決策は、明示的なパスを使用することです 'D:{yourfunctionname} \ホーム\サイト\ wwwrootに\ \'

+0

おかげで、それを試してみました: '用語、コマンドレット、関数、スクリプトファイル、または操作可能なプログラムの名前として認識されません「\ MyAppに\ My.App.exeが。」。名前のスペルを確認するか、パスが含まれている場合は、パスが正しいことを確認してから、もう一度やり直してください。 ' – ibiza

+1

しかしこれはうまくいった! '&「D:\ホーム\サイト\ wwwrootの\ MyAppに\ My.App.exe」' '.'は、この文脈で指しているところ疑問に思う... – ibiza

+0

あなたのスクリプトで'書き込みホストの$ pwd'はを行うことができますログファイルでそれを確認できますか?私はいつもそれが思ったD:\ホーム\サイト\ wwwrootの\ {yourfunction}私は前にこれを演奏:http://wragg.io/a-slack-slash-command-using-powershell-azure-functions/ –

関連する問題