Azure Stack Hub の Functions App を v2 で動か・・・せなかった。

2019年12月時点では。

そのうち対応されるのだと思います。

 

 

まず、App Service v82.0.2.10 でのデフォルトは v1 です。

Web ポータルの「Functions App の設定」からの v2 への変更は出来ません。

f:id:tkey_dll:20200119134258p:plain



そうは言っても画面に ~2 の表示もあるし、中身は対応してるんじゃないの?

という事で、試してみます。

 

まず、アプリケーション設定から「FUNCTIONS_EXTENSION_VERSION」を ~2 に変更します。

 

f:id:tkey_dll:20200115194912p:plain

 

 

続けて、host.json"version": "2.0" を追加します。

 

f:id:tkey_dll:20200119134602p:plain

 

 

このあたりは、Azure での手順に従っています。

docs.microsoft.com

 

 

一旦 Function App を再起動。

この時点でエラーが表示されて、もうダメな雰囲気

f:id:tkey_dll:20200119140831p:plain

 

 

だけど無視して Function を作成してみます。

 

2020-01-07_20h39_57

2020-01-07_20h40_47

UI は v2 っぽいですね!

「ポータル内」->「webhook + API」で作成します。

 

 

出来たそばからエラー。

「関数ランタイムを起動できません」

 

2020-01-07_20h41_51

 

無視して実行すると「500 Internal Server Error」となります。

<!DOCTYPE html>
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title> HTTP Error 500.0 - ANCM In-Process Handler Load Failure </title>
    </head>
    <body>
        <h1> HTTP Error 500.0 - ANCM In-Process Handler Load Failure </h1>
        <h2> Common causes of this issue: </h2>
        <ul>
            <li> The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found. </li>
            <li> The in process request handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the application. </li>
            <li> ANCM could not find dotnet. </li>
        </ul>
        <h2> Troubleshooting steps: </h2>
        <ul>
            <li> Check the system event log for error messages </li>
            <li> Enable logging the application process' stdout messages </li>
            <li> Attach a debugger to the application process and inspect </li>
        </ul>
        <h2>
            For more information visit:
             <a href="https://go.microsoft.com/fwlink/?LinkID=2028526"> <cite> https://go.microsoft.com/fwlink/?LinkID=2028526 </cite> </a>
        </h2>
    </body>
</html>

自動生成されたコードは .NET Core のもの。

ILogger も使われている事から、v2 で作成されている事が分かります。

 

ただ、動かない。

 

また、作られた Function にはホストキーが登録されていません。

f:id:tkey_dll:20200119140636p:plain

 

新しいホストキーを追加すると、ここで v2 への変更直後に表示されたエラーが発生します。

f:id:tkey_dll:20200119140831p:plain




一応コンソールからは .NET Core ランタイムの存在は確認出来ます。

f:id:tkey_dll:20200119141359p:plain

 

 

ランタイムが無いのではなく、v1 と v2 の動作モデルの違いによるものでしょうか。

 

f:id:tkey_dll:20200119143329p:plain

https://azure.microsoft.com/ja-jp/blog/introducing-azure-functions-2-0/




そもそも Issue が立っていて、「対応していない」と明言されていました。

 

2020-01-07_21h17_35

https://github.com/Azure/azure-functions-host/issues/3601#issuecomment-511557858

 

 

と言うわけで、今後に期待。