You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xamarin.Forms中Azure Blob存储图片无法显示的问题求助

Troubleshooting Azure Blob Image Not Showing in Xamarin.Forms

Hey there, let's dig into why your image from Azure Blob Storage isn't loading in your Xamarin.Forms app. The NotFound error you're seeing both in the app logs and when accessing the URL directly in the browser points to a core issue: the blob (your image) either doesn't exist at that location, or can't be accessed due to permissions or path mistakes.

First, let's recap the error details you shared:

HTTP Request: Could not retrieve https://xxxxxx.blob.core.windows.net/yyyy/kakashi.jpg, status code NotFound
ImageLoaderSourceHandler: Could not retrieve image or image data was invalid: Uri: https://lxxxxxx.blob.core.windows.net/yyyy/kakashi.jpg

And the browser error confirms this isn't just an app-specific issue:

<Error>
  <Code>ResourceNotFound</Code>
  <Message>
    The specified resource does not exist.
    RequestId:97933c69-a01e-014f-6669-f0502e000000
    Time:2018-05-20T18:33:28.4774584Z
  </Message>
</Error>

Here are the most common fixes to try, in order:

1. Verify the Blob's Exact Location and Filename

Azure Blob Storage is case-sensitive, so even a tiny typo will break things:

  • Log into the Azure Portal, navigate to your storage account, then find the container named yyyy (from your URL).
  • Check if kakashi.jpg exists in this container—make sure the filename matches exactly (no capital letters, no extra spaces, correct file extension).
  • Double-check that your storage account name (xxxxxx in the URL) and container name (yyyy) are spelled correctly in both your app code and the browser URL.

2. Check Container Permissions

By default, Azure Blob containers are set to Private access, which means you can't access blobs directly via their URL without authorization:

  • In the Azure Portal, go to your container's Access policy settings.
  • For testing purposes, temporarily set the access level to Blob (anonymous read access for blobs only)—then try accessing the URL again in your browser and app.
  • Note: For production apps, avoid using anonymous access. Instead, generate a SAS (Shared Access Signature) token and append it to your blob URL to grant time-limited, secure access.

3. Confirm the Blob Was Successfully Uploaded

It's possible the image never made it to Blob Storage in the first place:

  • Check your Xamarin.Forms upload code for unhandled exceptions. Did you add error handling to catch issues during upload?
  • In the Azure Portal, check the blob's file size—if it's 0 bytes, the upload failed. Review your upload logic to ensure you're writing the full image file to the blob.

4. Validate the URL in Your App

Make sure the URL your app is using matches exactly what you're testing in the browser:

  • Add a debug log in your app to print the full blob URL right before it's used to load the image. Compare this to the URL you're testing manually—look for typos, missing slashes, or incorrect container/storage account names.

Once you fix the root cause (whether it's a typo, permission issue, or failed upload), your image should load correctly in both the browser and your Xamarin.Forms app!

内容的提问来源于stack exchange,提问作者hugo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:13:46