如何部署Azure云服务的App_Data文件(Web角色) [英] How to deploy App_Data files with Azure cloud service (web role)

查看:184
本文介绍了如何部署Azure云服务的App_Data文件(Web角色)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只读的数据文件(IP地理定位)。目前它是在App_Data文件夹,这不包括在部署包的云服务。不像Web部署,没有复选框的Azure云服务部署包含/排除的App_Data。

I have a read-only data file (for IP geolocation) that my web role needs to read. It is currently in the App_Data folder, which is not included in the deployment package for the cloud service. Unlike "web deploy", there is no checkbox for an azure cloud service deployment to include/exclude App_Data.

有没有一种合理的方式来获得部署包,包括App_Data文件夹/文件?或使用Azure存储为这样的事情的更好的方式去是什么? (成本和性能明智)

Is there a reasonable way to get the deployment package to include the App_Data folder/files? Or is using Azure storage for this sort of thing the better way to go? (cost and performance wise)

我使用Visual Studio 2013,并在Azure SDK 2.2

Am using Visual Studio 2013 and the Azure SDK 2.2

更新:
- 研究发现,对App_Data文件实际上在/斌/的App_Data部署!因此,他们在那里。
- 其实最终将文件移动到存储BLOB,并将其复制在启动时应用蔚蓝的服务器上的本地存储区。这大大降低了部署包的大小,因为静态文件不被在包进行

UPDATE: - Found that the App_Data files are actually deployed under /bin/App_Data! So they are there. - Actually ended up moving the file to a storage blob, and copying it to a local storage area on the azure server in the app on startup. This greatly reduced the size of the deployment package, since the static file is not being carried in the package.

推荐答案

如果程序App_Data不为空,将在Azure网站上公布,你可以通过

If App_Data is not empty, it will be published on Azure website and you can access it via

var folder = Server.MapPath("~/App_Data/");

您还可以创建文件夹并没有写入文件

You can also create folders and write files there

var folder = Server.MapPath("~/somefolder/");
Directory.CreateDirectory(folder);
var path = folder + "file.txt";
File.AppendAllText(path, "some text");

这篇关于如何部署Azure云服务的App_Data文件(Web角色)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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