简体   繁体   English

本地文件Blob保存

[英]Local file blob save

I am a bit stuck with this Windows Azure Blob storage. 我对这个Windows Azure Blob存储有些困惑。

I have a controller that receive a file path (local). 我有一个接收文件路径(本地)的控制器。

So on the web page I do something loke this: 因此,在网页上,我做了一些这样的事情:

http:...?filepath=C:/temp/myfile.txt http:...?filepath = C:/temp/myfile.txt

On the web service I want to get this file and put it on the blob service. 在Web服务上,我想获取此文件并将其放在Blob服务上。 When I launch it in local there is no problem but when i publish it there is no way to get the file. 当我在本地启动它时,没有问题,但是当我发布它时,没有办法获取文件。 I always get: Error encountered: Could not find a part of the path 'C:/temp/myfile.txt'. 我总是得到:遇到错误:找不到路径'C:/temp/myfile.txt'的一部分。

Can someone help me. 有人能帮我吗。 Is there a solution ? 有解决方案吗?

First i would say to get proper help you would need to provide better description about your problem. 首先,我会说要获得适当的帮助,您需要提供有关您的问题的更好描述。 What do you mean by "On the web service"? “网络服务”是什么意思? Is it a WCF web role which seems to match with your partial problem description. 它是WCF网络角色,似乎与您的部分问题描述相匹配。 However most of the web service use http://whatever.cloudapp.net/whatever.svc as well as http://whatever.cloudapp.net/whaterever.aspx?whatever if added. 但是,大多数Web服务都使用http://whatever.cloudapp.net/whatever.svc以及http://whatever.cloudapp.net/whaterever.aspx?添加了什么。 Have you done something like that in your application. 您是否在应用程序中做了类似的事情。

You have also mentioned the controller in your code which makes me think it is a MVC based Web Role application. 您还在代码中提到了控制器,这使我认为它是基于MVC的Web角色应用程序。

I am writing above information to help you to formulate your question much better next time. 我正在写以上信息,以帮助您下​​次更好地提出问题。

Finally Based on what you have provided you are reading a file from local file system (C:\\temp\\myfile.txt) and uploading to Azure Blob. 最后,根据您提供的内容,您正在从本地文件系统(C:\\ temp \\ myfile.txt)中读取文件,并将其上传到Azure Blob。 This will work in compute Emulator and sure will fail in Windows Azure because: 这将在计算模拟器中起作用,并且肯定会在Windows Azure中失败,因为:

In your Web Role code you will not have access to write on C:\\ drive and that's why file is not there and you get error. 在您的Web角色代码中,您将无权在C:\\驱动器上进行写操作,这就是为什么文件不存在并且出现错误的原因。 Your best bet is to use Azure Local Storage to write any content there and then use Local Storage to read the file and then upload the Azure Blob. 最好的选择是使用Azure本地存储在其中写入任何内容,然后使用本地存储读取文件,然后上载Azure Blob。 Azure Local storage is designed to write any content from web role (you will have write permission). Azure本地存储旨在写入Web角色中的任何内容(您将具有写入权限)。

Finally, I am concern with your application design also because Azure VM are no persisted so having a solution to write to anywhere in VM is not good and you may need to directly write to Azure storage without using system memory, if that is possible anyways. 最后,我也对您的应用程序设计感到担心,因为Azure VM无法持久保存,因此无法在VM中写入任何内容的解决方案就不好了,并且如果可能的话,您可能需要不使用系统内存就直接写入Azure存储。

您是否确认文件在Azure服务器上存在?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 可以选择... into outfile而不是将其保存到文件中,而是将其保存在blob中 - Can select … into outfile not save it into a file, but save it in blob instead 自动将文件从一个本地磁盘保存到另一个 - Auto save file from one local disk to another Azure教程 - 如何使用本地blob存储 - Azure tutorial - How to use local blob storage 如何使用 url 从 csv 文件下载/保存图像到我本地 Windows 机器上的特定创建文件夹中? - How to download/save images from a csv file using url into specific created folder on my local Windows Machine? 访问Windows Azure的BLOB上存储的文本文件 - Accessing the text file that is stored on BLOB of Windows Azure 如何使用 C# 在 Windows 应用程序中使用 SaveFileDialog 在来自 HttpClient 的本地计算机上保存 Zip 文件? - How to save Zip file on local machine which is coming from HttpClient using SaveFileDialog in Windows application using C#? 无法在 windows 10 上的本地文件系统上保存 rdd - unable to save rdd on local filesystem on windows 10 允许保存文件但看不到? - Permission to save file but not to see? 将文件保存在 %temp% 文件夹中? - Save file in %temp% folder? 将文件保存到桌面-可行吗? - Save File to Desktop - Feasibility?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM