I am learning the features of Azure. The scripts I've tested so far work just fine.
I am at the point where I am trying to figure out a way to download files (20MB +) through Azure Function.
The idea is that the Azure function will first check to see if the authenticated user is allowed to download the file before it holds the request stream and stores it in the BLOB repository.
Here is the client-side code that creates StreamContent
for StreamContent
bytes to the server:
using (Stream fileStream = ...)
{
var streamContent = new StreamContent(fileStream);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
streamContent.Headers.ContentLength = fileStream.Length;
streamContent.Headers.Add("FileId", fileId);
var responseMessage = await m_httpClient.PutAsync(<validURI>, streamContent);
responseMessage.EnsureSuccessStatusCode();
succeeded = true;
}
Here is the server side code.
[FunctionName("upload-data")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "put")]HttpRequestMessage req, TraceWriter log)
{
try
{
return req.CreateResponse(HttpStatusCode.OK);
}
catch (Exception exc)
{
return req.CreateResponse(HttpStatusCode.InternalServerError, exc);
}
}
I put a breakpoint at the beginning of the method. I expected the breakpoint to be deleted right after the client side sends the request, no matter how big the file is. However, it is not.
, Azure Function - . , , 4 -, .
Azure Function ? ?