Example of adding logging to a .NET Core Web application based on NLog. Initially, add the NLog.Web.AspNetCore package via Nuget. Then add a nlog.config file to the project root with the following content: <?xml version="1.0" encoding="utf-8"?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="true">
<targets>
<target name="file" xsi:type="FileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}" />
</targets>
</nlog>
Simple example of a class with a method for getting a square preview image in .NET Core, using the SixLabors.ImageSharp library. Example: using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Pixe…
Currently, the company Microsoft is devoting more and more resources to .NET Core, which is truly cross-platform and universal. Therefore, it would not be superfluous to record the process of setting up access to a site written in .NET Core in Ubuntu Linux using Apache.
This publication provides an example of how to perform an asynchronous request to the server without reloading the current page, using JQuery on .NET Core. So let's get started. First, we need to create a Web site project on .NET Core, for example...
This publication was written as a simple instruction for myself, for memory, so as not to forget. The proposed option was used for authorization through a VK token in a server application. First, let's create a method to send an HTTP request and get a response from the server:…
To add support for CorsPolicy in a .NET Core application, open the Startup.cs file and modify the ConfigureServices and Configure methods as follows: ConfigureServices public void ConfigureServices(IServiceCollection services) { // Add...
In this publication, we will consider how to connect to the MySQL database from a .Net Core application. 1. If you have not installed .Net Core yet, install it: .NET Core. 2. Then create a new .NET Core project: mkdir MySQlCoreSample cd MySQlCoreSample dotnet new webapi
В предыдущей публикации мы создали простейший ASP.NET MVC проект на .NET Core и добавили в него контроллер. Весь проект состоял из 4 файлов и содержал только самое необходимое. Теперь мы добавим в этот проект представления. Скачать исходник…
In this publication, I hope to start a cycle of stories about developing an ASP.NET MVC application on .NET Core without using Visual Studio. For application development, I will use VS Code (essentially a text editor with bells and whistles), and nothing else.
1. Install .NET Core . 2. Create a new .NET Core project mkdir Sample01 cd Sample01 dotnet new After executing these commands in the Sample01 folder, 2 files will appear: "Program.cs", "project.json". This is the simplest template for a .NET Core application. ...