17/10/2024

IIS Max Allowed Content Length

Last week one of our third party integrator who is using our web api has asked what is the maximum number of ids they can query.

In this api they use, they send (Post) array of ids and in return, API provide status of those records. So they wanted to know what is the maximum limit they can send in the ID array.

I didn't had a answer straight away. That got me thinking.

Ids are in body, because it is a post request. So "maxQueryString" limit will not comes into play as far as I can see. 

I have done bit of Googling and found out there is a setting in IIS, which filter requests. It was called "maxAllowedContentLength". As I found out this is a security setting which limits some one sending huge requests. This setting can be found in system.webServer/security/requestFiltering section. If you looking in the web.config file you can see it in following section:


This setting is there to prevent DoS attacks.

Value in this setting is in bytes. Default value seems to be 30,000,000 (30 million) bytes, which is approximately 28.6 MB.  Most of time in production web servers, we tends to go much lower limit.

When you consider 28.6 MB, it can accommodate large number of IDs for our supplier, but on the other hand in order to full fill that request, back end (data stores) must work very hard. There fore, I have advice not to send too many Ids in there request and split their request to several sub request (paging) in order to prevent data store servers overwhelming. 

If you exceed "maxAllowedContentLength" limit, you will get HTTP 404.13 - Request Entity Too Large.



01/10/2024

Connecting Codestral with VS Code

These days AI hype is so high that I though I also should test some tools I can use to increase my productivity. That's when I came across Codestral by Mistral AI. 

Codestral is a coding assistant tool which can be integrated to your development environment and best of all is, it is free.

So I have tested whether I can integrate Codestral with VS Code. Here is what I experienced.

Step 1 - Create a Mistral AI account. Don't worry it is free (as of now).

Step 2 - Enable Codestral. Codestral is like part of Mistral AI (like a module), but it need activate separately.

Step 3 - Open VS Code and install "Continue" extension. Continue extension is use to integrate VS code and Codestral. This extension can be use to integrate VS Code with other AI Code assistance as well. But we here looking into how we can integrate with Codestral.


Once installed it will appear on left side bar in VS Code.


You can move it to right side, so it will not cover your file explorer and other important sections. But it totally up to you.

Step 4 - Generate API key. Go to Mistral AI website again and go to Codestral section and click on the Generate API button to generate a API key.


Step 5 - Add Codestral to continue extension. Click on the models drop down and click on add chat model.


Then select "Mistral" as the provider and "Codestral" as the model. Enter the API key you have generated before in the box provided. Finally click Connect.

That's it, now you have connected with your Codstral account in VS code.

In next article we see basic usage of the Codestral in VS code.





Introduction to SQL Server Statistics - Tutorial

Wishing you all, my loving readers, Happy New Year 2025! This is the first blog for the year 2025. As a new initiative, I'm going to (tr...