簡體   English   中英

我可以在沒有 AzureWebJobsStorage 連接字符串的情況下執行 Azure webjobs 嗎?

[英]Can i execute Azure webjobs without AzureWebJobsStorage connectionstring?

當我創建新的 Azure webjob 項目時,我可以在app.config部分看到 connectionstring 部分,如下所示:

<connectionStrings>
    <!-- The format of the connection string is "DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY" -->
    <!-- For local execution, the value can be set either in this config file or through environment variables -->
    <add name="AzureWebJobsDashboard" connectionString="" />
    <add name="AzureWebJobsStorage" connectionString="" />
  </connectionStrings>

在我的 webjob 函數中,我只與我的應用程序數據庫交互。

  1. 那么我真的需要為 azure webjobs 創建另外兩個數據庫嗎?

當我從 Visual Studio 運行 webjobs 時,出現以下錯誤:

應用程序:WebJobTest.exe 框架版本:v4.0.30319 描述:由於未處理的異常,進程被終止。 異常信息:System.InvalidOperationException 堆棧:在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) 在 Microsoft.Azure .WebJobs.JobHost.Call(System.Reflection.MethodInfo, System.Object) 在 WebJobTest.Program.Main()

當我嘗試訪問 webjobs 日志時,它顯示:WebJob Details WebJobTest

通過使用以下格式 DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY 指向存儲 Microsoft Azure WebJobs 運行時日志的 Microsoft Azure 存儲帳戶,確保在 Microsoft Azure 網站配置中設置名為 AzureWebJobsDashboard 的連接字符串。

我猜這是因為沒有正確的數據庫連接字符串。

  1. 上述兩個錯誤之間可能有什么聯系?

AzureWebJobsDashboard連接字符串是可選的 - 只有在您希望能夠將儀表板 UI 用於日志等時才需要它。

AzureWebJobsStorage連接字符串是必需的 - 雖然您可能沒有使用任何存儲實體,但 WebJobs 運行時確實使用一些 blob 和其他存儲實體來進行自己的跟蹤和操作。

添加到馬修的回答,AzureWebJobsStorage使用WebJobs SDK時,使用Azure的WebJobs你不必使用WebJobs SDK,所以你不必有AzureWebJobsStorage連接字符串時,才需要。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM