Visual Studio 2019-在WebApp中添加WebJob项目 [英] Visual Studio 2019 - Adding WebJob project in WebApp

查看:67
本文介绍了Visual Studio 2019-在WebApp中添加WebJob项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的解决方案中,我有一个aspnet核心2.2 WebApp,我想添加一个现有的项目(例如webJob),但是没有选择:从现有项目中添加WebJobs

In my solution i have an aspnet core 2.2 WebApp, and i want to add an existent project like webJob but there isn't the option: Add WebJobs from existent project

为什么?通过相同的过程,我在其他.Net应用程序上添加了WebJobs,并且该选项显示在Visual Studio 2019中

Why? With the same procedure i add WebJobs on my other .Net application, and this option is shown in visual studio 2019

编辑

使用英语更改了图像.有时会显示添加">现有项目"为Azure WebJobs,但如果单击它,则会显示此错误:

Changed images with english language. Sometimes the Add > Existing project as Azure WebJobs it's showned but if I click on it it shows this error:

(所选项目是aspnet.core 2.2.WebApp)

(the selected project is the aspnet.core 2.2. WebApp)

单击此键后,将不再显示添加">作为Azure WebJobs的现有项目".

After this click , the Add > Existing project as Azure WebJobs is no longer visible.

推荐答案

更新:

例如,如果要手动将控制台应用程序部署为webjob.

For example, if you want to deploy a console app as webjob manually.

  1. 创建控制台应用程序.下面是我的代码:

  1. Create a Console app. Below is my code:

使用系统;

命名空间testwebjob{班级计划{静态void Main(string [] args){Console.WriteLine(这是我的第一个网络工作!");}}}

namespace testwebjob { class Program { static void Main(string[] args) { Console.WriteLine("This is my first webjob!"); } } }

2.构建控制台应用程序,然后右键单击并选择以下内容:

2.Build the console app, then right click and choose this:

3.转到bin-> Debug-> xxx,然后您将找到一个包含以下文件的文件夹,添加run.cmd并将其压缩.

3.Go to bin -> Debug -> xxx, then you will find a folder with below files,add a run.cmd and zip them.

这是我的run.cmd的内容:

This is the content of my run.cmd:

@echo off

dotnet testwebjob.dll

4.转到天蓝色的Web应用程序,搜索webjob.点击添加并上传zip文件.

4.Go to azure web app, search webjob. Click add and upload the zip file.

5.然后,Web作业已部署.这是日志:

5.Then the web job has be deployed. This is the log:

原始答案:

文档,您会发现通过Web项目启用自动WebJobs部署"是.net Framework Web应用程序支持的功能.似乎不支持.net核心Web应用.

From the documentation, you will find that 'Enable automatic WebJobs deployment with a web project' is a feature supported by .net framework web app. It seems .net core web app is not supported.

实际上,已经有关于此的反馈.您可以在这里投票:

In fact there is already a feedback about this. You can vote here:

https://developercommunity.visualstudio.com/content/problem/806009/existing-project-as-azure-webjob-results-in-generi.html

也许您可以尝试不使用此功能,并选择在部署Web应用程序后部署Web作业.:)

Maybe you can try not to use this feature and choose to deploy the web job after the web app is deployed.:)

这篇关于Visual Studio 2019-在WebApp中添加WebJob项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆