1

When I try to resize an image, using AzureReader2, I get a 404. However, this does not happen in development with the storage emulator, only when deployed to Azure. It also doesn't happen when there is no resizing.

So

http://myapp.azurewebsites.net/c-images/product-images/1dc870bd-21a2-4e02-9b60-4750f6b20a7e.png

redirects to

http://mystorage.blob.core.windows.net/product-images/1dc870bd-21a2-4e02-9b60-4750f6b20a7e.png

but

http://myapp.azurewebsites.net/c-images/product-images/1dc870bd-21a2-4e02-9b60-4750f6b20a7e.png?width=100

results in a 404.

Here is my config

<add name="AzureReader2" prefix="~/c-images/" connectionString="DefaultEndpointsProtocol=https;AccountName=mystorage;AccountKey=***" endpoint="http://mystorage.blob.core.windows.net/" />

Any ideas?

Dan Friedman
  • 4,941
  • 2
  • 41
  • 65
  • Can you reproduce it running locally *without* the storage emulator, just trying to connect directly to Azure Blob Storage? – Lilith River Jul 17 '13 at 17:28
  • Good suggestion, but connecting directly works fine. I don't see anything else in the config that looks different and noteworthy. – Dan Friedman Jul 17 '13 at 17:42
  • So the only time it can't reach this blob is when it's running in the cloud. That would point to either a network/permissions error or an authentication failure. Are these blobs public? – Lilith River Jul 19 '13 at 17:56
  • The blobs are public. Without the query string, the browser is redirected to the blob. With the query string, IIS sees it as a static file and looks for it at a physical path, C:\DWASFiles\Sites\[myapp]\VirtualDirectory0\site\wwwroot\c-images\product-images\1dc870bd-21a2-4e02-9b60-4750f6b20a7e.png. So is seems apparent that ImageResizer is at work, but gets skipped or returns the request to IIS. I created a brand new MVC4 project, added the bare minimum and pushed to Azure and have same problem, so either there is a bug or I am doing something wrong over and over. – Dan Friedman Jul 19 '13 at 19:07
  • Can I assume this has been tested on Azure Web Sites? I've spent hours trying to figure this out. I can't attach a debugger so I've been adding logging to the source code, but it is super difficult to debug anything that way. Not sure how else to approach it. – Dan Friedman Jul 19 '13 at 20:55
  • Did you get this sorted @DanFriedman ? – richardwhatever May 14 '14 at 12:31
  • Yep, I had `Allow precompiled site to be updated` checked in the publish wizard. It's due to a bug in .NET, see the comments in the answer. – Dan Friedman May 14 '14 at 14:06

1 Answers1

0

The issue was that I was precompiling the site when I published it to Azure. Specifically, I had Allow precompiled site to be updated checked and Do on merge selected. Bug filed.

Dan Friedman
  • 4,941
  • 2
  • 41
  • 65
  • It's a [known bug in the .NET framework](http://stackoverflow.com/questions/12397/net-virtualpathproviders-and-pre-compilation), one of many reasons precompilation is never a good idea. – Lilith River Jul 20 '13 at 18:39
  • I've [updated the troubleshooting guide to be less specific](http://imageresizing.net/docs/troubleshoot) "You are using AppHarbor and have Precompilation enabled." -> "You have Precompilation enabled." – Lilith River Jul 20 '13 at 18:48