相同的图像,但 Azure Web 应用程序和本地计算机中的 base64 字符串不同
Same Image, but different base64 string in Azure Web app and local machine
我有一个很奇怪的问题。我在 Azure 应用程序服务中托管的 asp.net 网络 API 中将图像转换为 base64string,并得到错误的图像字符串。
如果我 运行 本地机器中的代码,我会得到正确的值。
public static string GetImageFromSharePointOnline(string imageUrl)
{
try
{
using (var clientContext = CreateContext(URL))
{
clientContext.ExecutingWebRequest += ExecutingWebRequest;
FileInformation fileInformation = null;
Stream returnStream = new MemoryStream();
int readCount;
var buffer = new byte[8192];
Uri image = new Uri(imageUrl);
try
{
fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, image.AbsolutePath);
while ((readCount = fileInformation.Stream.Read(buffer, 0, buffer.Length)) != 0)
{
returnStream.Write(buffer, 0, readCount);
}
}
catch (Exception ex) { }
returnStream.Seek(0, SeekOrigin.Begin);
return "data:image/" + GetFileExtensionFromUrl(imageUrl) + ";base64," + Convert.ToBase64String(buffer);
// return Convert.ToBase64String(buffer);
}
}
catch (Exception ex) { }
}
Azure web api 输出:
data:image/jpg;base64,VHdEqK7rHUHQQ0VMQUMN/T0MMGKzMFUEsTYAdpNTJgXxeGxYh+qoll/MSfCD7AOvxrk3738OrTjPyJZGHi5kcUcsCBYkCJtAUgdeq27da89em0/L0vPW/gt8zw0mAwkS74zmwY9Qe411c+31+rm6cvlx47jzly7b7I1F5Htew9g7Seyt79PmZZ05/VwYcPjsGFlKY6NtIJMgDk2N9d37AK49u21/Lq15axZy+Jw893kmiAlc38xPC1/h1+NTXrtqu3LWlfkeKmwcnypPEp1jfsYV26dJtMuTfn81Pi8ZHzYw6hl8R2sLjRSelTrtjW4OeudjNiQwwlimPDudStzGh0PXs7tK4r02v5dk0k/ClzeBiR8a8iQojqy2ZVCnU27K9eXTa7ea8uvOTXwXY495AAuToAK68ubA/h8Xjwgb0WWX8zMAyj2AHT41x9O1vr06tOMnsWjF4DAUUoWDG4vewsBbpavH6r1xFHkvTsE0LS4sYjnUX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谁能帮我解决这个问题。
您正在初始化 MemoryStream:
Stream returnStream = new MemoryStream();
(应该是var returnStream = new MemoryStream();
)
作为从 Stream 中读取的字节的容器。
使用缓冲区从源流中读取图像字节:
var buffer = new byte[8192];
对于 NetworkStream 来说没问题。
假设 Uri image = new Uri(imageUrl);
在两个环境中代表同一个对象,你读取一个 [buffer]
字节数(这是最大值,实际读取的字节数可能小于该值)并写入读取的字节数 -值存储在 readCount
变量中 - 到 MemoryStream:
try
{
fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, image.AbsolutePath);
while ((readCount = fileInformation.Stream.Read(buffer, 0, buffer.Length)) != 0)
{
returnStream.Write(buffer, 0, readCount);
}
}
当源Stream读取结束时,MemoryStream包含Image字节。
此时,您想将图像字节转换为 Base64String。
当然,您需要转换 MemoryStream 的内容,returnStream
,而不是 buffer
内容,后者仅用作来自源流的字节的临时容器。所以只需更改:
Convert.ToBase64String(buffer);
至:
Convert.ToBase64String(returnStream.ToArray());
在调用 returnStream.ToArray()
之前设置 returnStream.Position = 0
在这种情况下没有必要,但也没有坏处。
旁注:那些空的 catch
块对你没有好处。添加日志功能或删除。
我有一个很奇怪的问题。我在 Azure 应用程序服务中托管的 asp.net 网络 API 中将图像转换为 base64string,并得到错误的图像字符串。
如果我 运行 本地机器中的代码,我会得到正确的值。
public static string GetImageFromSharePointOnline(string imageUrl)
{
try
{
using (var clientContext = CreateContext(URL))
{
clientContext.ExecutingWebRequest += ExecutingWebRequest;
FileInformation fileInformation = null;
Stream returnStream = new MemoryStream();
int readCount;
var buffer = new byte[8192];
Uri image = new Uri(imageUrl);
try
{
fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, image.AbsolutePath);
while ((readCount = fileInformation.Stream.Read(buffer, 0, buffer.Length)) != 0)
{
returnStream.Write(buffer, 0, readCount);
}
}
catch (Exception ex) { }
returnStream.Seek(0, SeekOrigin.Begin);
return "data:image/" + GetFileExtensionFromUrl(imageUrl) + ";base64," + Convert.ToBase64String(buffer);
// return Convert.ToBase64String(buffer);
}
}
catch (Exception ex) { }
}
Azure web api 输出:
data:image/jpg;base64,VHdEqK7rHUHQQ0VMQUMN/T0MMGKzMFUEsTYAdpNTJgXxeGxYh+qoll/MSfCD7AOvxrk3738OrTjPyJZGHi5kcUcsCBYkCJtAUgdeq27da89em0/L0vPW/gt8zw0mAwkS74zmwY9Qe411c+31+rm6cvlx47jzly7b7I1F5Htew9g7Seyt79PmZZ05/VwYcPjsGFlKY6NtIJMgDk2N9d37AK49u21/Lq15axZy+Jw893kmiAlc38xPC1/h1+NTXrtqu3LWlfkeKmwcnypPEp1jfsYV26dJtMuTfn81Pi8ZHzYw6hl8R2sLjRSelTrtjW4OeudjNiQwwlimPDudStzGh0PXs7tK4r02v5dk0k/ClzeBiR8a8iQojqy2ZVCnU27K9eXTa7ea8uvOTXwXY495AAuToAK68ubA/h8Xjwgb0WWX8zMAyj2AHT41x9O1vr06tOMnsWjF4DAUUoWDG4vewsBbpavH6r1xFHkvTsE0LS4sYjnUX2Lor+y3QHutXtz7WXFeXTjLMwtCMEV2uREx0EGSiObJVHJloLES1BajSoqwkQorssNTK4SEIpkws4MC+fv/AOGCw9/QH4E3ry67ftenKfuEooq4nWtxRjs7NKDXKYS5HF5MTC942K+xlF1+8VdLim0zAH0/D/04PbWSQ3PeFAA+y5r17Xy8uU8DUUVhuPQak14vVbgjDKrDVWAIPeDrSrA71Xio3GpKR4opBY+xtCPwr14Xy8u0zATh4wcuM+xv6TXR0v7a8Oc/dDLFDpf7q4nYq+o4h/k7gGxLJcnQC7jtrfK/uY6TwWuGVGzI97W2ncBYm5AuOntrp3viufWeTNFFXG6lmEx+cYf8QKHI9hJH7KC/FFUaIeaqLyOWiiyrNIqj2BiK+jpfEcG881wcAVthXdgKqOLOKDkzVUWoqguRWqNCGJiTTgmJd1iAR76xtvJ7b10t9DnGenJMrjp8pyVNj9OO8qdW92lq8enbF8PbTjmZoFKTFIY3G1lNiDXrLl42YWYj5U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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
谁能帮我解决这个问题。
您正在初始化 MemoryStream:
Stream returnStream = new MemoryStream();
(应该是var returnStream = new MemoryStream();
)
作为从 Stream 中读取的字节的容器。
使用缓冲区从源流中读取图像字节:
var buffer = new byte[8192];
对于 NetworkStream 来说没问题。
假设 Uri image = new Uri(imageUrl);
在两个环境中代表同一个对象,你读取一个 [buffer]
字节数(这是最大值,实际读取的字节数可能小于该值)并写入读取的字节数 -值存储在 readCount
变量中 - 到 MemoryStream:
try
{
fileInformation = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, image.AbsolutePath);
while ((readCount = fileInformation.Stream.Read(buffer, 0, buffer.Length)) != 0)
{
returnStream.Write(buffer, 0, readCount);
}
}
当源Stream读取结束时,MemoryStream包含Image字节。
此时,您想将图像字节转换为 Base64String。
当然,您需要转换 MemoryStream 的内容,returnStream
,而不是 buffer
内容,后者仅用作来自源流的字节的临时容器。所以只需更改:
Convert.ToBase64String(buffer);
至:
Convert.ToBase64String(returnStream.ToArray());
在调用 returnStream.ToArray()
之前设置 returnStream.Position = 0
在这种情况下没有必要,但也没有坏处。
旁注:那些空的 catch
块对你没有好处。添加日志功能或删除。