【问题标题】:TeamCity with showing a modal dialog box显示模式对话框的 TeamCity
【发布时间】:2016-11-19 01:10:06
【问题描述】:

我有带有 Azure WebJobs 的 ASP.NET MVC 应用程序。我已设置自动将 WebJobs 发布到我的 Azure 云。但是当通过 VS 发布 WebJobs 时,会显示模式对话框。我认为 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

【问题讨论】:

  • 你能绕过这个限制吗?

标签: asp.net azure


【解决方案1】:

我遇到了同样的问题。基本上,为了访问 azure 计划,需要对 azure 门户进行身份验证,因此需要输入凭据的模式。 我设法在这个博客上四处走动:

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

Azure 门户下载页面的链接已过时。可以找到更新的链接here

发布设置文件下载后,我将其复制到我们的 TC 服务器,因为我不希望它包含在项目中。

然后我在项目的Properties文件夹下创建了一个webjobs.props文件

这是内容:

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

希望有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-01
    • 2011-10-09
    • 1970-01-01
    相关资源
    最近更新 更多