Azure部署在项目中找不到我的文件 [英] Azure deploy can't find my file in the project

查看:48
本文介绍了Azure部署在项目中找不到我的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的控制台项目中的资源文件位于 * root */res/cosmo.pdf 下.

I've a resource file in my console project under *root*/res/cosmo.pdf.

在我的应用程序中获取文件路径的代码是:

The code for fetching the filepath in my application is:

System.IO.Directory.GetCurrentDirectory() + "\\res\\cosmo.pdf"

将项目作为webjob发布到azure Web应用程序并运行它时,出现错误:

When publishing the project to an azure web app as a webjob and running it I get the error:

One or more errors occurred. (Could not find a part of the path 'D:\local\Temp\jobs\triggered\testclient\rhdistle.3og\res\cosmo.pdf'

我应该在哪里放置资源文件,以便天青知道从哪里获取资源文件?

Where should I place resource files so azure knows where to get them?

推荐答案

找不到路径'D:\ local \ Temp \ jobs \ triggered \ testclient \ rhdistle.3og \ res \ cosmo.pdf'的一部分

Could not find a part of the path 'D:\local\Temp\jobs\triggered\testclient\rhdistle.3og\res\cosmo.pdf'

首先,检查pdf文件是否已发布到KUDU中的D:\ home \ site \ wwwroot.

Firstly, check if the pdf file has been publish to D:\home\site\wwwroot in KUDU.

在缺少pdf文件的情况下,您可以使用 Environment.GetEnvironmentVariable("WEBJOBS_ROOT_PATH"); 来获取webjob的根目录目录.

With the pdf file missing, you could use Environment.GetEnvironmentVariable("WEBJOBS_ROOT_PATH"); to get the root path direcroty of webjob.

WEBJOBS_ROOT_PATH ,它是webjob文件的位置,您可以指定一个绝对路径,否则该值将与默认的根路径结合在一起:

WEBJOBS_ROOT_PATH which is location of webjob files, you can specify an absolute path, or otherwise the value will be combined with the default root path:

D:/home/site/wwwroot/+ WEBJOBS_ROOT_PATH(相对)到所需的pdf.

有关更多详细信息,您可以参考此文章.

For more detail, you could refer to this article.

这篇关于Azure部署在项目中找不到我的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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