2016-10-31 73 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上正确创建/更新。

希望得到这个帮助