In the database I use a column of datatype varbinary(max)
to save an image, but when I load the image, I get a timeout.
public async Task<byte[]> UploadImage(IFormFile req)
{
using var ms = new MemoryStream(16 * 1024);
await req.CopyToAsync(ms);
byte[] result = ms.ToArray();
ms.Close();
ms.Dispose();
return result;
}
public string RetrieveImage(byte[] data)
{
return string.Format("data:image/png;base64,{0}", Convert.ToBase64String(data, 0, data.Length));
}
I tried to find out but it keeps giving error
An unhandled exception occurred while processing the request.
Win32Exception: The wait operation timed out.
Unknown locationSqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, bool breakConnection, Action wrapCloseInAction)
Data displayed in SQL Server is <Binary data>