Friday, October 07, 2022

How to increase file upload size limit in ASP.NET Core

ASP.NET Core 2.0 or 2.1 enforces 30MB (~28.6 MiB) max request body size limit, be it Kestrel and HttpSys. Under normal circumstances, there is no need to increase the size of the HTTP request. But when you are trying to upload large files (> 30MB), there is a need to increase the default allowed limit.

Kestrel is a cross-platform web server for ASP.NET Core and that’s included by default in ASP.NET Core project templates. Kestrel can be used as a standalone server or with a reverse proxy server, such as IIS, Nginx, or Apache

Hosted on IIS

Remember in the ASP.NET, we used to set maxRequestLength in web.config file to increase the default limit of 4MB. Like,

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
     <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="4294967295"  />
      </requestFiltering>
    </security>  
   </system.webServer>
</configuration>
  

Similarly, for ASP.NET Core application, we can increase the default limit of 30MB by setting maxAllowedContentLength property in the web.config file. The default ASP.NET Core application template doesn’t create the web.config file. It is created when you publish the application. However, you can also add it manually (if not present) to the root of the application with the following code.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <authentication mode="Windows" />
    <httpRuntime enableVersionHeader="false" />
  </system.web>
  <!-- To customize the asp.net core module uncomment and edit the following section. 
  For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
    </modules>
    <handlers>
      <remove name="aspNetCore" />
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <!-- processPath="dotnet" arguments=".\Mobility.Core.Web.API.dll"  update with these values on stage or prod servers-->
    <aspNetCore requestTimeout="00:20:00" processPath="dotnet" arguments=".\myCoreWeb.Core.Web.API.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
      <environmentVariables />	 
    </aspNetCore>
	 <security>
        <requestFiltering>
          <!-- This will handle requests up to 50MB -->
          <requestLimits maxAllowedContentLength="52428800" />
        </requestFiltering>
      </security>
  </system.webServer>
</configuration>
<!--ProjectGuid: 82a05c43-b244-4222-a1ff-ebe99b445a14-->

Hope this helps!

Open Live Writer–Google Blogger login issues

When it comes to blogging I am big fan of Open Live Writer aka OLW. Recently I had issues with google connections. May be some of you might have same problems connecting to blogger.

The Volunteers at Microsoft has released a new version of OLW that has fixed the connection issue. OLW now works fine with Google Blogger v3. I have included below the direct link to the team's frequently updated setup copy called "Nightly" which contains several unreleased features that you can try out. Download the latest version from the link below.

I have found this information at GitHub forums related to OLW https://github.com/OpenLiveWriter

Download OLW (Build 0.5.1.2) - Nightly

Wednesday, October 05, 2022

Path of revolution of moon

The moon travels around the Earth in an elliptical orbit, a slightly stretched-out circle. When the moon is closest to Earth, its rotation is slower than its journey through space, allowing observers to see an additional 8 degrees on the eastern side. When the moon is farthest, the rotation is faster, so an additional 8 degrees are visible on the western side.

The rotational period of the moon wasn't always equal to its orbit around the planet. Just like the gravity of the moon affects ocean tides on the Earth, gravity from Earth affects the moon. But because the moon lacks an ocean, Earth pulls on its crust, creating a tidal bulge at the line that points toward Earth.

Does the Moon Orbit the Sun or the Earth? | WIRED

Gravity from Earth pulls on the closest tidal bulge, trying to keep it aligned. This creates tidal friction that slows the moon's rotation. Over time, the rotation was slowed enough that the moon's orbit and rotation matched, and the same face became tidally locked, forever pointed toward Earth.

The moon is not the only satellite to suffer friction with its parent planet. Many other large moons in the solar system are tidally locked with their partner. Of the larger moons, only Saturn's moon Hyperion, which tumbles chaotically and interacts with other moons, is not tidally synchronized.

The lunar rotation determined whether the infamous Man in the Moon, a face-like pattern of dark maria on the Earth-facing side, wound up pointing toward our planet. Gravity created an Earth-side bulge in the moon, slowing down its rotation in the past to create the synchronous rotation and keeping the longer lunar axis toward our world.

The moon takes almost 27 days to revolve around the earth. But between two full moons, there are 29.5 days. This is because the earth also travels a distance through space during that time around the sun. It has to cover an extra distance (which takes 2 more days) if it has to be exactly behind the earth and sun again.

Tuesday, October 04, 2022

What is Connective Tissue?

Connective tissues, as the name implies, support and connect different tissues and organs of the body. They are widely distributed in every part of the body. They originate from the mesoderm (the middle germinal layer of the embryo).

Connective tissue is made up of a few cells present in the intercellular framework of protein fibres secreted by the cells, known as collagen or elastin. The cells also secrete a thin gel of polysaccharides, which together with fibres make matrix or ground substance.

Connective tissues contain three types of fibres: collagen, elastic and reticular

Collagen fibres are the most widespread and made up of fibrous protein, collagen. Collagen fibres are flexible and have high tensile strength (comparable to steel).

Elastic fibres form a network and can be stretched like a rubber band. They are made up of protein elastin. They retain their original shape and size once the force is removed.

Reticulate fibres consist of collagen and glycoproteins. They are thin and form a delicate network. They join connective tissues to neighbouring tissues.

There are various kinds of cells present in different types of connective tissues. They secrete different types of fibres and matrices. Fibroblasts or adipose cells are stationary and macrophages, mast cells, monocytes, lymphocytes are migrating cells.

Fibroblasts are found in developing tissues and play an important part in wound-healing. They are spindle-shaped and present between collagen fibres. They secrete tropocollagen and other substances found in the matrix.

Macrophages are also known as scavenger cells. They wander through connective tissues, clean up debris and remove bacteria and other antigens by phagocytosis.

Sunday, June 05, 2022

How to build using command line from Visual Studio?

Here is how we can build using command line or terminal for Visual Studio using msbuild tool

1. Open Terminal from Visual Studio

2. On the terminal type msbuild to build current project 

msbuild /t:build

3. To clean here is the syntax

msbuild /t:clean

4. To Rebuild 

msbuild /t:rebuild

More examples

Examples:

MSBuild MyApp.sln -t:Rebuild -p:Configuration=Release

MSBuild MyApp.csproj -t:Clean

                             -p:Configuration=Debug;TargetFrameworkVersion=v3.5

For more detailed information, see https://aka.ms/msbuild/docs