2017-01-26 10 views
-1

Azure関数ツールを使用してビジュアルスタジオ内でAzure関数をデバッグしようとすると問題が発生します。 私は過去に(おそらく1ヶ月前に)働いていましたが、なんらかの理由で今は動作しませんでした。Azure関数 - ビジュアルスタジオが起動しません

私は、Visual Studioを再起動すると、私はappsettings.json

AppSettings.json

内のストレージアカウントを設定してなかった全く新しいきれいな空色の機能プロジェクトを作成し、唯一のタイマーテンプレートプロジェクトに変更しようとしました
{ 
    "IsEncrypted": false, 
     "Values": { 
     "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=YYYAccountKey=XXX;", 
     "AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=YYY;AccountKey=XXX;" 
     } 
    } 

host.json

それが失敗した後、私は、次

あるgithubの例からhost.jsonにいくつかのコンテンツを追加しようとしました0
{ 
    "id": "9f4ea53c5136457d883d685e57164f05", 
    "functionTimeout": "00:05:00", 
    "http": { 
     "routePrefix": "api" 
    }, 
    "watchDirectories": [ "Shared" ], 
    "queues": { 
     "maxPollingInterval": 2000, 
     "batchSize": 16, 
     "maxDequeueCount": 5, 
     "newBatchThreshold": 8 
    }, 
    "serviceBus": { 
     "maxConcurrentCalls": 16, 
     "prefetchCount": 100, 
     "autoRenewTimeout": "00:05:00" 
    }, 
    "eventHub": { 
     "maxBatchSize": 64, 
     "prefetchCount": 256 
    }, 
    "tracing": { 
     "consoleLevel": "verbose", 
     "fileLoggingMode": "debugOnly" 
    }, 
    "singleton": { 
     "lockPeriod": "00:00:15", 
     "listenerLockPeriod": "00:01:00", 
     "listenerLockRecoveryPollingInterval": "00:01:00", 
     "lockAcquisitionTimeout": "00:01:00", 
     "lockAcquisitionPollingInterval": "00:00:03" 
    } 
} 

しかし、それはどちらも役に立ちません。私はVisual Studioでデバッグを開始すると

をどうなり

は、コマンドプロンプトウィンドウが開き、前に、Azureの機能文字のロゴが表示され、その後、テキストの束は、(非常に非常に迅速に< 1秒)を示していますコマンドプロンプトが表示されなくなります。ここで

ウィンドウが

console results

完全なコンソールメッセージ

    %%%%%% 
       %%%%%% 
      @ %%%%%% @ 
      @@ %%%%%%  @@ 
     @@@ %%%%%%%%%%% @@@ 
    @@  %%%%%%%%%%  @@ 
     @@   %%%%  @@ 
     @@  %%%  @@ 
      @@ %%  @@ 
       %% 
       % 

Autofac.Core.DependencyResolutionException: An error occurred during the activat 
ion of a particular registration. See the inner exception for details. Registrat 
ion: Activator = WebScriptHostManager (DelegateActivator), Services = [Microsoft 
.Azure.WebJobs.Script.WebHost.WebScriptHostManager], Lifetime = Autofac.Core.Lif 
etime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> A h 
ost ID must be between 1 and 32 characters, contain only lowercase letters, numb 
ers, and dashes, not start or end with a dash, and not contain consecutive dashe 
s. 
Parameter name: value (See inner exception for details.) ---> System.ArgumentExc 
eption: A host ID must be between 1 and 32 characters, contain only lowercase le 
tters, numbers, and dashes, not start or end with a dash, and not contain consec 
utive dashes. 
Parameter name: value 
    at Microsoft.Azure.WebJobs.JobHostConfiguration.set_HostId(String value) 
    at Microsoft.Azure.WebJobs.Script.WebHost.WebHostResolver.CreateScriptHostCon 
figuration(WebHostSettings settings) 
    at Microsoft.Azure.WebJobs.Script.WebHost.WebHostResolver.EnsureInitialized(W 
ebHostSettings settings) 
    at Microsoft.Azure.WebJobs.Script.WebHost.WebHostResolver.GetWebScriptHostMan 
ager(WebHostSettings settings) 
    at Microsoft.Azure.WebJobs.Script.WebHost.AutofacBootstrap.<>c__DisplayClass0 
_0.<Initialize>b__2(IComponentContext ct) 
    at Autofac.RegistrationExtensions.<>c__DisplayClass5_0`1.<Register>b__0(IComp 
onentContext c, IEnumerable`1 p) 
    at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass0_0`1.<ForDelegate>b_ 
_0(IComponentContext c, IEnumerable`1 p) 
    at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(ICompo 
nentContext context, IEnumerable`1 parameters) 
    at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) 
    --- End of inner exception stack trace --- 
    at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) 
    at Autofac.Core.Resolving.InstanceLookup.Execute() 
    at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti 
meScope currentOperationScope, IComponentRegistration registration, IEnumerable` 
1 parameters) 
    at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration reg 
istration, IEnumerable`1 parameters) 
    at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistratio 
n registration, IEnumerable`1 parameters) 
    at Autofac.Core.Container.ResolveComponent(IComponentRegistration registratio 
n, IEnumerable`1 parameters) 
    at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, 
Service service, IEnumerable`1 parameters, Object& instance) 
    at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext cont 
ext, Service service, IEnumerable`1 parameters) 
    at Autofac.Integration.WebApi.AutofacWebApiDependencyScope.GetService(Type se 
rviceType) 
    at Autofac.Integration.WebApi.AutofacWebApiDependencyResolver.GetService(Type 
serviceType) 
    at Microsoft.Azure.WebJobs.Script.WebHost.DependencyResolverExtensions.GetSer 
vice[TService](IDependencyResolver resolver) 
    at Microsoft.Azure.WebJobs.Script.WebHost.WebApiConfig.Initialize(HttpConfigu 
ration config, ScriptSettingsManager settingsManager, WebHostSettings settings, 
Action`2 dependencyCallback) 
    at WebJobs.Script.Cli.Actions.HostActions.StartHostAction.<RunAsync>d__21.Mov 
eNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot 
ification(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.GetResult() 
    at WebJobs.Script.Cli.ConsoleApp.<RunAsync>d__4`1.MoveNext() 
Press any key to continue . . . 
+0

サードパーティのプロバイダを使用する代わりに、内蔵の機能を使用して写真をアップロードしてください。 –

答えて

0

は、あなたの依存リゾルバに問題があるように思わ閉じる前にあったとき、私は得ることができ、画像のリンクです。 Autofacを取り外して手動で行ってください。あなたのスクリーンショットで

、2行目が表示されます。

"Autofac.Core.Container.ResolveComponent ..."

Autofacは1つの依存性注入フレームワークです。 Azure関数に依存関係を注入するために使用されていると思います。あなたはそれに精通していないので、私はAzureファンクションロジックに何らかの既存の機能を使用しようとしていると思います。

私の最善のアドバイスは:新しいAzure関数を追加し、それにスムーズに機能を追加することです。

+0

これを拡張してください。オートファックとは何ですか?私はそれをgoogledしましたが、私は時間の開発者のC#プログラムでそれを見つけたことはありません – Steve

+0

私は何も追加していません。単にビジュアルスタジオで "Azure Functions Project"を作成し、プロジェクトを右クリックして "新しいazure関数"を追加し、オプションから最も単純なテンプレートの1つを選んだだけです。 – Steve

0

プロジェクトに使用したフォルダにスペース、ダッシュ、特殊文字が含まれていないことを確認してください。

現在のところ、フォルダ名はホストIDに適用されるものよりも優先され、この問題が発生する可能性があります。これはCLIで修正されましたが、まだリリースされていないため、次のアップデートで対処します。

+0

ホスト。jsonが元の投稿の上に掲載されています – Steve

+0

あなたのエラーを見て、あなたのhost.jsonを完全に逃しました。 :) これは、実行している可能性が高いので、更新された答えを見てください。 –

+0

フォルダ名を参照すると、最後のフォルダか完全なパスを意味するだけですか?プロジェクト\ TestFunctionApp – Steve

関連する問題