Azure 函数无法引用文件
Azure function not able to reference file
我创建了一个函数,它使用一个需要文件引用才能工作的包。
所以文件夹结构是这样的(请原谅我的视觉效果不佳)
-ConnectorFolder
|-ConfigFolder
|-connectorconfig.properties
|-ServiceFolder
|-Service.cs
-Function.cs
在Service.ts文件夹中我运行这段代码:
public static SessionManager CreateSession()
{
ConfigFactory.setConfigLocation("ConnectorFolder/ConfigFolder/connectorconfig.properties");
}
在我的本地设备上,我将“复制到输出目录”设置为“始终复制”,此代码 运行 就可以了。
但是,当我 运行 它在 Azure 上时,出现以下错误
connector.exception.Exeption: Invalid url to location ]ConnectorFolder/ConfigFolder/connectorconfig.properties[
这是程序包的内部错误,但它让我相信文件无法解析?
azure 是否需要不同的方式来引用文件路径,还是我遗漏了什么?
However when I run it on Azure I get the following error
connector.exception.Exeption: Invalid url to location ]ConnectorFolder/ConfigFolder/connectorconfig.properties[
确保您的文件位于根目录中,即 D:\home\site\wwwroot
Azure Function Project 所在的位置。
请参阅here了解更多详细信息。
我创建了一个函数,它使用一个需要文件引用才能工作的包。
所以文件夹结构是这样的(请原谅我的视觉效果不佳)
-ConnectorFolder
|-ConfigFolder
|-connectorconfig.properties
|-ServiceFolder
|-Service.cs
-Function.cs
在Service.ts文件夹中我运行这段代码:
public static SessionManager CreateSession()
{
ConfigFactory.setConfigLocation("ConnectorFolder/ConfigFolder/connectorconfig.properties");
}
在我的本地设备上,我将“复制到输出目录”设置为“始终复制”,此代码 运行 就可以了。 但是,当我 运行 它在 Azure 上时,出现以下错误
connector.exception.Exeption: Invalid url to location ]ConnectorFolder/ConfigFolder/connectorconfig.properties[
这是程序包的内部错误,但它让我相信文件无法解析?
azure 是否需要不同的方式来引用文件路径,还是我遗漏了什么?
However when I run it on Azure I get the following error connector.exception.Exeption: Invalid url to location ]ConnectorFolder/ConfigFolder/connectorconfig.properties[
确保您的文件位于根目录中,即 D:\home\site\wwwroot
Azure Function Project 所在的位置。
请参阅here了解更多详细信息。