Receive 400 Bad Request from Image Resizer request in Azure - azure

ImageResizer is running as an Azure virtual application (after ImageResizer hotfix). This runs fine in Azure emulation but is having problems in Azure cloud. Image Resizer is working fine if no query string arguments are specified and the url redirects to blob storage, but if a query string argument is specified then I receive a 400 "Bad Request" error.
Below is a screenshot of my browser:
My Azure instance is running Windows Server 2012. I have also disabled the DiskCache plugin to reduce the problem.

I got the same problem as You. I used fiddler to see if I could figure out what went wrong and I think I fixed it. It's a problem with AzureReader2 and how it concatenates URL'S.
A specific example from fiddler is this URL: http://xxx.blob.core.windows.net//card-images/14_main_image.png
As you can see it got two slashes in a row which gives you the 400 "bad request".
I downloaded the sourcecode for AzureReader2 and replaced all occurrences of "CloudBlobClient.BaseUri.OriginalString" with "CloudBlobClient.BaseUri.OriginalString.TrimEnd('/', '\')"
I don't know if it's the best fix, but at least it's working until a better fix comes. If you are interested, I can send you the compiled dll.
Best Regards
Martin

I would have added this as a comment in reply to user2486535, but my StackOverflow rep is not sufficient for posting comments yet...
You are probably getting the 400 Bad Request at this time because the latest version of Microsoft.WindowsAzure.Storage (3.0.2.0) is not compatible with the current Storage Emulator released with the Windows Azure SDK (2.2).
It's explained at the bottom of this article, under "Storage Emulator Guidance":
http://blogs.msdn.com/b/windowsazurestorage/archive/2013/11/27/windows-azure-storage-release-introducing-cors-json-minute-metrics-and-more.aspx
As of January 27, Microsoft has released a preview version of the Windows Azure Storage Emulator (2.2.1) that is compatible with Microsoft.WindowsAzure.Storage (3.0.2.0):
http://blogs.msdn.com/b/windowsazurestorage/archive/2014/01/27/windows-azure-storage-emulator-2-2-1-preview-release-with-support-for-2013-08-15-version.aspx
Hopefully this helps you get by until the next official release of the Windows Azure SDK.

Related

New deployed azure function returns 404 Not Found error

Hey I have deployed new azure function using Azure dev ops CI/CD. The function app has been deployed successfully and when I go to the main URL, it says your function app is running. I tried to test the end points("/save") using azure portal and the output is 404 Not found. The same results when I use POST man as well. Any help would be appreciated?
2020-11-21T11:30:45.769 [Error] The following 2 functions are in error:
Get: The function type name 'DocumentContextFunction.Functions.GetDocument'
is invalid.
Save: The function type name
'DocumentContextFunction.Functions.SaveDocument' is invalid.
I have fixed this by updating the value of the "FUNCTIONS_EXTENSION_VERSION" from 1 to 3. For some reason every time I deployed using Azure CI/CD, its value is set to 1, so I have to manually change it to be 3.
I encountered this error when my build targeted win-x64 whereas the Azure Function Platform was configured as 32 bit.
In my case I had a function created in portal. I then published a function via visual studio. After publishing the portal created function was 404 not found and I could not even delete the function from the portal.
Exact same code in a new function worked as expected.
This is not intuitive and were no indications in the portal that previous portal created functions would break.
This maybe buried somewhere in documentation but I would have expected a warning in azure before allowing other functions to break without code changes.
The author's question helped me understand where the problem was coming from. In my case, it was not about the CI/CD pipeline doing anything funny.
It was my IaC code which was not setting up the function app properly. It picks version ~1 by default but I had to set it to ~3.
My function apps were working until I included a new custom package with a later version of Microsoft.Extensions.Logging. My functions were using Microsoft.Extensions.Logging 2.1.1. The package had version 7.0.0, which is for Net7. It was incompatible with my Net6 projects.
When the package was added, the Microsoft.Extensions.Logging version in my project was updated to 7.0.0. The were no compile errors, but debugging showed that the assembly could not be loaded. This was causing the 404.
Changing the package version back to 2.1.1 corrected the problem.
This is what worked for me...
Note: I was getting 404 on my function which is a nodejs and inline editing on the browser.
Open your function.json and take a backup as we are going to change it.
See if in your function.json there are two different settings with "direction": "in"
For me there were two. I tried deleting but it keep coming back.
Next I went to 'Integrations' (on left menu) and opened my trigger and deleted it. This will recycle your trigger. And hope this works for you too.

.net core 3.1 Azure Deploy issues 500 then 404

Image #1 from "Help Support"
Image #2 from "Help Support
Image #3 from "Help Support
First off THANK YOU for looking at this and providing any help you might be able to provide me. I have a .net core 3.1 website I have deployed to azure and made changes and update regularly without and issue before. I updated it to .net core 3.1 recently and deployed it to azure without any issues. I then made more changes and updated it and not get 500 error and clearly can not assess the site online anymore. I initially got a 500 error and then removed a some code that i thought was incomplete from my startup.cs file that was for AspNet.Security.OAuth.LinkedIn nugget package. I then redeployed and got a 404 error. I am a bit lost since i get no errors on local host. At no point have I had any issues with loading my site on local host. I have included images from the "help / support" part in azure. I do see it is asking me to move up to higher tier. I had been using the highest option of dev/test with no issues before. Is that issue? I doubted it since i had never had issues before.
Please feel free to ask any questions you might have. I am still looking for answers on my own and plan to post an answer if i can find one on my own but am feeling a bit stuck. Thank you for any help you might be able to provide.
The "App Service Plan Density Check" and "SNAT Port Exhaustion" were do to being on too low of tier. The rest was due to me updating code but then not creating a new "App Service". If you are updating to .net core 3.1 create a new "App Service" with 3.1 from the beginning and everything should work. Using my older "App Service" instance did work for a while but ultimately broke.

Why does my Umbraco installation from within the Azure Marketplace always fail?

I am trying to install Umbraco by using the Azure Marketplace. There they offer a template for it. I am always receiving the error below. I tried to install it a couple of times now but I always get the same error.
Does anybody know what this error message means? Is anybody able to install Umbraco by using the template in the Azure Marketplace?
]
You're asking 2 questions above.
Please see my answers and proposed troubleshooting guide/workaround below:
The error message means that the MSDeploy process failed due to some error which renders it unable to deploy the web deploy package for your Umbraco web app.
Yes I am able to provision a Umbraco web app from the Azure Market successfully (Location: Central US) and couldn't reproduce your issue
Troubleshooting Guide:
Append .scm in front of the azurewebsites.net of your Umbraco Web App as shown below and go to the Url.
Click on the Diagnostic Dump. You will be prompted to download a .zip file
Extract the zip file. You should see 2 folders at root level
Go into
LogFiles\SiteExtensions\MSDeploy
You should see the detail log files for MSDeploy
Detailed MSDeploy log messages are in the appManagerLog.xml file.
If it is related to client side issue which can be resolved by yourself, you can try to resolve it and try again.
If it is related to server side issue, you should create a support ticket for Microsoft to look into with the detailed MSDeploy log which pinpoints the root cause which will help them a lot.
Hope this is useful.
A Microsoft employee confirmed this is a bug in the application currently. I have to wait for a fix.
I have encountered numerous problems with the Azure installer of Umbraco, try setting it up in VS2015 then publishing it to Azure. I have found that this works well.

ImageResizer with AzureReader2 while hosted on GitHub Depoyed Azure Website throws 404s

When I call use AzureReader to resize an image I get a 404, yet if I don't do a resize the passthrough call works perfectly.
I think it is due to the problem stated on the /resizer.debug.ashx page:
"Precompilation is enabled. Image providers may not work as expected."
The problem is I'm deploying through GitHub and don't know how to control precompilation.
So my question(s) are:
1. Am I right in thinking this is precompilation related? If not then what?
If so
2. how can I block precompilation on GitHub based deploy
3. how can I work around precompilation problem? (i've seen http://sunali.com/2008/01/09/virtualpathprovider-in-precompiled-web-sites/ but am not able to see how to apply to my problem)
On other point... incredibly similar code deployed fine to AAzure via Github 6 months ago and worked... has Azure Websites changed something with deployment in last 6 months or so?
Many thanks,
RIchard
Microsoft's VirtualPathProvider framework does not work in Precompiled mode.
Typically, this manifests as failure on direct access (without resizing).
However, AzureReader2 is unique among the blob providers in that it redirects to the original blob instead of directly serving the image when no changes are required.
You may be able to set vpp=false on the <add name="AzureReader2 vpp="false"/> element an get it to work.

I am getting Bad Request (400) messages for Emulated and REAL Azure storage

I am developing an Azure website, and I want to make use of Blob storage. I am using VS2013, Azure SDK 2.2. I have tried Azure Storage 2.1.0.4 from NuGet, I have tried using the latest 3.0.2.0 too. I have upgraded the emulator to the latest preview version 2.2.1, I was using 2.2.0 before.
My issue is, it doesnt matter if I point at the emulator or real storage, I get Bad Request 400 errors (invalid headers).
I set up a really simple form application, with a single button to make this easy.
private void button1_Click(object sender, EventArgs e)
{
var account = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudBlobClient blobClient = account.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("UserImages");
if (!container.Exists())
{
container.Create();
container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Off });
}
}
Everything looks good until container.Exists() executes, and then I get an unhandled error (Bad Request 400). I have tried a few different operations and I get the same unhelpful message every time.
I am storing the Azure Connection string in the appSettings section, and in this simple example I have tried pointing at a real Storage Account, and the emulator, and I get the 400 error every time.
My config file has this:
<appSettings>
<add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;AccountName=[MyAccountName];AccountKey=[MYREALKEY]" />
</appSettings>
Using the Server Explorer in VS2013, I can happily connect to both the Emulator and real storage, and access Blob storage without issue.
This is effectively stopping me adding the ability to my site to upload files to the storage account.
Anyone else having this problem? As far as I know, I have tried older versions and the latest versions of the important components. I have always had SDK 2.2 though.
Any suggestions gratefully received.
For information, I followed this example, which I found in the Azure management portal:
http://www.windowsazure.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs-20/
Thanks
Ian
To see naming rules, please check out this link: http://msdn.microsoft.com/en-us/library/windowsazure/dd135715.aspx. From this documentation page:
A container name must be a valid DNS name, conforming to the following
naming rules:
Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not permitted in
container names.
All letters in a container name must be lowercase.
Container names must be from 3 through 63 characters long.
Regarding getting 400 error with storage emulator, please check the storage client library version. If it's 3.x, then you would need to install storage emulator 2.2.1 released in preview today. More information about this can be found here: http://blogs.msdn.com/b/windowsazurestorage/archive/2014/01/16/windows-azure-storage-emulator-2-2-1-preview-release-with-support-for-2013-08-15-version.aspx
This drove me insane for two days. Installing/Uninstalling the SDK, emulators, Azure Storage NuGet packages etc. I finally got the emulator working as well as real storage. The MSI you download to install the preview version of the emulator 2.2.1 contains a readme - I didnt know it was there, but it contains some pretty important instructions!
3. Copy all files from the following path:
For 32-bit OS: "%ProgramFiles%\Windows Azure Storage Emulator 2.2.1\devstore"
For 64-bit OS: "%ProgramFiles(x86)%\Windows Azure Storage Emulator 2.2.1\devstore"
to the following path:
"%ProgramFiles%\Microsoft SDKs\Windows Azure\Emulator\devstore"
If prompted, choose to replace the existing files with the new ones.
It turns out the MSI doesnt update the files actually used by the emulator at run time! You have to perform this task by hand. I feel sooo stupid for not seeing this basic instruction. Turns out RTFM was the answer!

Resources