2016-10-31 117 views
0

我有Azure WebJobs的ASP.NET MVC應用程序。我已經設置了將WebJobs自動發佈到Azure Cloud。但是,當通過VS發佈WebJobs那裏顯示模式對話框。我認爲TeamCity也是如此,但它會產生錯誤並且發佈失敗。顯示模態對話框的TeamCity

我如何禁用它併發布WebJobs?

 [Step 1/1] 
     [15:19:13][Step 1/1] Unhandled Exception: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. 
     [15:19:13][Step 1/1] at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask[T](Task`1 task) 
     [15:19:13][Step 1/1] at Microsoft.Web.WebJobs.Publish.Tasks.CreateScheduledWebJob.<>c__DisplayClass1f.<GetAuthorizationHeader>b__1e() 
     [15:19:13][Step 1/1] at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     [15:19:13][Step 1/1] at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     [15:19:13][Step 1/1] at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     [15:19:13][Step 1/1] at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     [15:19:13][Step 1/1] at System.Threading.ThreadHelper.ThreadStart() 
     [15:19:16][Step 1/1] Process exited with code 255 
     [15:19:16][Step 1/1] Step Publish to Azure (with WebJobs) (Command Line) failed 
+0

你能繞過這個限制嗎? – Regis

回答

1

我有同樣的問題。基本上,爲了訪問天藍色的日程安排,通過Azure門戶進行身份驗證是必要的,因此需要輸入憑據的模式。 我設法繞過去關注此博客:

https://azure.microsoft.com/en-us/blog/enabling-command-line-or-continuous-delivery-of-azure-webjobs/

鏈接到蔚藍的門戶網站下載頁面已經過時。更新的鏈接可以找到here

一旦發佈設置文件被降級,我將它複製到我們的TC服務器,因爲我不希望它包含在項目中。

然後創建了一個webjobs.props文件的項目

enter image description here

這裏的屬性文件夾下的內容:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
<Target Name="AfterSetScheduleProperties" AfterTargets="SetScheduleProperties"> 
    <PropertyGroup> 
     <PublishSettingsPath>C:\Local_Properties\Azure\FileName.publishsettings</PublishSettingsPath> 
     <SubscriptionId>XXXXXX-XXXX-XXXX-XXXXX-XXXXXXXX</SubscriptionId> 
    </PropertyGroup> 
</Target> 

我發現訂閱ID在我下載的發佈設置文件中。 發佈設置文件路徑是TC服務器上的路徑。

現在在發佈webjob時,日程安排已在Azure上正確創建/更新。

希望得到這個幫助