Подробнее:
- Версия NET: .NET 8
- Исходный код: C#
- Переменные среды: задаются как локально, так и в Azure, сопоставляя URL-адрес и строка подключения к хранилищу
- Проблема: после развертывания функции в Azure не удается удалить образ большого двоичного объекта. В Azure задаются те же переменные среды, что и при локальном выполнении.
Код: Выделить всё
Exception while executing function: EliminarImagen Could not load file or assembly 'System.Memory.Data, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
- зависимую от платформы
- Автономный
- win-x64
- portable
Это файл .csproj:
Код: Выделить всё
Код: Выделить всё
using Azure.Storage.Blobs;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
namespace FuncionEliminarImagenes.Clases
{
public static class EliminarImagen
{
[FunctionName("EliminarImagen")]
public static async Task Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route =
"eliminaImagen/{containerName}/{imageName}")] HttpRequest req, string containerName,
string imageName, ILogger log)
{
log.LogInformation("Initializing the function, ready to receive requests...");
BlobServiceClient blobServiceClient = new BlobServiceClient(Conexion.connectionString);
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName);
// Check if container exists
if (!await containerClient.ExistsAsync())
{
log.LogError($"The container {containerName} does not exist.");
return new NotFoundObjectResult($"The container {containerName} does not exist.");
}
BlobClient blobClient = containerClient.GetBlobClient(imageName);
log.LogInformation($"Attempting to delete the image: {imageName} in the container: {containerName}");
if (!await blobClient.ExistsAsync())
{
log.LogWarning($"The image {imageName} does not exist in the container {containerName}.");
return new NotFoundObjectResult($"The image {imageName} does not exist in the container {containerName}.");
}
else
{
var deleteResponse = await blobClient.DeleteIfExistsAsync();
if (deleteResponse)
{
log.LogInformation($"The image {imageName} was deleted from the container {containerName}.");
return new OkObjectResult($"The image {imageName} was successfully deleted.");
}
return new StatusCodeResult(200);
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... deployment