Removing Kestrel binding warning

This is an old question but you can resolve that conflict between launchSettings.json and appSettings.json with “externalUrlConfiguration”: true Kestrel configuration in appSettings.json: “Kestrel”: { “EndpointDefaults”: { “Protocols”: “Http1AndHttp2” }, “Endpoints”: { “HTTPS”: { “Url”: “https://localhost:4433” } } And this is launchSettings.json content: { “profiles”: { “TestApplication”: { “commandName”: “Project”, “launchBrowser”: true, “externalUrlConfiguration”: true, //add this … Read more

Increase upload request length limit in Kestrel

I found this helpful announcement that confirms there is a 28.6 MB body size limit starting with ASP.NET Core 2.0, but more importantly shows how to get around it! To summarize: For a single controller or action, use the [DisableRequestSizeLimit] attribute to have no limit, or the [RequestSizeLimit(100_000_000)] to specify a custom limit. To change … Read more

Remove “Server” header from ASP.NET Core 2.1 application

This solution works on IIS 10+ version and allows to remove x-powered-by and server headers in server response. In IIS 10 a new attribute was added: removeServerHeader. We need to create web.config file in asp.net core application with following content: <?xml version=”1.0″ encoding=”utf-8″?> <configuration> <system.webServer> <security> <requestFiltering removeServerHeader=”true” /> </security> <httpProtocol> <customHeaders> <remove name=”X-Powered-By” /> … Read more

Visual Studio 2017 Enable SSL

Ports are locked down in IIS Express so that it doesn’t have to be run as Administrator… Valid Ports are 44300 – 44399 Check out the Dev Community article https://developercommunity.visualstudio.com/content/problem/39430/changing-port-number-in-a-web-project-does-not-imm.html You can edit launchSettings.json, but the ssl ports must fall in this range.

How to use HTTPS / SSL with Kestrel in ASP.NET Core 2.x?

The basics. Using Server URLs If you want to associate your server to use all the IP addresses assigned to the server/web host then you can do this: WebHost.CreateDefaultBuilder(args) .UseUrls(“http://localhost:5000”, “http://*:80”) .UseStartup<Startup>() .Build(); Note: The string format used in the UseUrls() method is: http://{ip address}:{port number}. – If you use an * (asterisks) for the … Read more

Which web server are you using in production for ASP.NET Core on a *nix server?

Use Kestrel, it’s the way going forward. Refer to this: Change to IIS hosting model. Does this mean it will work with say, Apache? Yes and indeed that’s the recommended approach. However, never expose Kestrel to outside world directly. Always put it behind a web server like nginx, IIS, HAProxy or Apache. More about Kestrel: … Read more

How to watch for file changes “dotnet watch” with Visual Studio ASP.NET Core

If you want to use ASP.NET 2.x or 3.x you need to change it a bit. The watch tool is a global tool now and you don’t need to add it as a reference any longer The syntax is slightly different “Watch”: { “executablePath”: “dotnet.exe”, “workingDirectory”: “$(ProjectDir)”, “commandLineArgs”: “watch run”, “launchBrowser”: true, “launchUrl”: “http://localhost:5000/”, “environmentVariables”: … Read more