View Packages.cs
Install-Package Microsoft.AspNetCore.Authentication.JwtBearer | |
// It enables JWT authentication in ASP.NET Core | |
Install-Package Microsoft.AspNetCore.Identity.EntityFrameworkCore | |
// This enable Identity in EF core | |
Install-Package Microsoft.EntityFrameworkCore | |
// This enable EF core | |
Install-Package Microsoft.EntityFrameworkCore.Design | |
// This package helps EFCore Design | |
Install-Package Microsoft.EntityFrameworkCore.SqlServer | |
// It provides support for creating and validating a JWT token. |
View _Layout.cshtml
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<title>@ViewBag.Title</title> | |
</head> | |
<body> | |
<div> | |
@RenderBody() |
View Startup.cs
public IWebHostEnvironment WebHostEnvironment { get; } | |
public Startup(IWebHostEnvironment webHostEnvironment) | |
{ | |
WebHostEnvironment = webHostEnvironment; | |
} | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddControllersWithViews(); | |
#if DEBUG | |
if (WebHostEnvironment.IsDevelopment()) |
View ViewData.cshtml
<html> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Customer Management</title> | |
<script src="~/lib/jquery/jquery.js"></script> | |
<link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" /> | |
</head> | |
<body> | |
@{ |
View HomeController.cs
public class HomeController : Controller | |
{ | |
public ViewResult Index() | |
{ | |
ViewData["Title"] = "Customer Details"; | |
Customer _customer = new Customer() { | |
custid = 1, | |
name = "John Smith", | |
address = "USA", |
View winform.cs
private void btnCheck_Click(object sender, EventArgs e) | |
{ | |
bool result = CheckFileExists(txtURL.Text); | |
if (result) | |
{ | |
MessageBox.Show("The file exists on the server.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); | |
} | |
else | |
{ | |
MessageBox.Show("The file couldn't be found on the server.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); |
View HomeController.cs
public class HomeController : Controller | |
{ | |
public ViewResult Details() | |
{ | |
return View(); | |
} | |
} |
View log.txt
2020-08-24 12:58:22.306 +05:30 [INF] CoreSpider is running and the Status code "OK" | |
2020-08-24 12:58:22.307 +05:30 [INF] Worker running at: "2020-08-24T12:58:22.3073606+05:30" | |
2020-08-24 12:58:35.012 +05:30 [INF] CoreSpider is running and the Status code "OK" | |
2020-08-24 12:58:35.013 +05:30 [INF] Worker running at: "2020-08-24T12:58:35.0134560+05:30" | |
2020-08-24 12:58:47.011 +05:30 [INF] CoreSpider is running and the Status code "OK" | |
2020-08-24 12:58:47.012 +05:30 [INF] Worker running at: "2020-08-24T12:58:47.0123668+05:30" | |
2020-08-24 12:58:58.158 +05:30 [INF] CoreSpider is running and the Status code "OK" | |
2020-08-24 12:58:58.159 +05:30 [INF] Worker running at: "2020-08-24T12:58:58.1588869+05:30" | |
2020-08-24 12:59:10.445 +05:30 [INF] CoreSpider is running and the Status code "OK" | |
2020-08-24 12:59:10.446 +05:30 [INF] Worker running at: "2020-08-24T12:59:10.4465566+05:30" |
View cmd.bat
:: Create a Windows Service | |
sc create WorkerService DisplayName="WorkerServiceDotNetCore" binPath="C:\full\path\to\WorkerServiceDotNetCore.exe" | |
:: Start a Windows Service | |
sc start WorkerService | |
:: Stop a Windows Service | |
sc stop WorkerService | |
:: Delete a Windows Service |
View Worker.cs
public class Worker : BackgroundService | |
{ | |
private readonly ILogger<Worker> _logger; | |
private HttpClient client; | |
public Worker(ILogger<Worker> logger) | |
{ | |
_logger = logger; | |
} | |
public override Task StartAsync(CancellationToken cancellationToken) | |
{ |
NewerOlder