Merge branch 'feature/Deploy_CI_CD' into develop

This commit is contained in:
Samuele Locatelli
2021-05-26 20:43:23 +02:00
27 changed files with 480 additions and 90 deletions
+102
View File
@@ -0,0 +1,102 @@
variables:
# NUGET_PATH: 'C:\Tools\nuget.exe'
# MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
# ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
# EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
# DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
VERS_MAIN: '1.0'
NEW_REL: ''
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
}
echo $hasSource
stages:
- build
- test
- staging
- deploy
- release
- installer
build:
stage: build
before_script:
- *nuget-fix
- dotnet restore
script:
- dotnet build
test:
stage: test
only:
- develop
needs: ["build"]
script:
- dotnet test
staging:
stage: staging
only:
- develop
needs: ["build"]
# before_script:
# - *nuget-fix
# - dotnet restore
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj
staging:
stage: deploy
only:
- master
needs: ["build"]
# before_script:
# - *nuget-fix
# - dotnet restore
script:
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj
- dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj
release:
stage: release
only:
#- feature/Deploy_CI_CD
- master
needs: ["build"]
artifacts:
paths:
- publish/
script:
- dotnet publish -c Release -o ./publish MP.Stats/MP.Stats.csproj
# AC:install:
# stage: installer
# rules:
# - if: '$CI_COMMIT_BRANCH == "master"'
# when: manual
# # only:
# # - tags # the build process will only be started by git tag commits
# before_script:
# - *nuget-fix
# - '& "$env:NUGET_PATH" restore GPW.sln'
# - *version-fix
# script:
# # Admin ZIP package
# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Admin.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Admin/GPW_Admin.csproj'
# # Commesse ZIP package
# - '& "$env:MSBUILD_PATH" /p:m=8 /p:AspnetMergePath=$env:ASPNET_MERGE_PATH /T:Package /P:Configuration=SPS /p:PublishProfile=SPS.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SPS_PROD/$env:NEW_REL/GPW_Commesse.zip /p:DeployIisAppPath="Default Web Site/GPW/ADMIN" /p:PackageAsSingleFile=True /p:OutputPath=bin/ GPW_Commesse/GPW_Commesse.csproj'
# needs: ["AC:build"]
+36
View File
@@ -0,0 +1,36 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/MP.Stats/bin/Debug/net5.0/MP.Stats.dll",
"args": [],
"cwd": "${workspaceFolder}/MP.Stats",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
+42
View File
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/MP.Stats/MP.Stats.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/MP.Stats/MP.Stats.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/MP.Stats/MP.Stats.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
+35 -14
View File
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------
# Egalware 2021.05.25
#
# AppDeploy -AppPool MP.STATS -SourceDir c:\Steamware\installers\MP.STATS -ZipFile MP.STATS.zip -DestDir c:\inetpub\wwwroot\MP\STATS
# .\AppDeploy.ps1 -AppPool MP.STATS -SourceDir c:\Steamware\installers\MP\STATS -ZipFile MP.STATS.zip -DestDir c:\inetpub\wwwroot\MP\STATS2
#
# Powershell script per deploy applicazione Blazor / dotnet core
#
@@ -29,6 +29,13 @@ param (
[string]$DestDir
)
# conf x logging
$logDir = "c:\Steamware\tmp"
$logFile = "$logDir\Script.log"
$logMirror = "$logDir\Mirror.log"
$utilDir = "c:\Steamware\tmp"
$installDir = "c:\Steamware\installers\"
# recupera timestamp x logging
function Get-TimeStamp
{
@@ -37,14 +44,14 @@ function Get-TimeStamp
# registra log!
function DoLog($txt2log)
{
Write-Output "$(Get-TimeStamp) $txt2log" | Out-File $filelog -Append
Write-Output "$(Get-TimeStamp) $txt2log" | Out-File $logFile -Append
}
# esegue e registra log
function ExecuteLog($txt2log)
{
Write-Output "-------------------------------------------------------------------------------------------------------------------------------------------------" | Out-File -FilePath "$filelog" -Append
Write-Output "$(Get-TimeStamp) $txt2log" | Out-File -FilePath "$filelog" -Append
Invoke-Expression "$txt2log 2>&1 | Out-File -FilePath $filelog -Append"
Write-Output "-------------------------------------------------------------------------------------------------------------------------------------------------" | Out-File -FilePath "$logFile" -Append
Write-Output "$(Get-TimeStamp) $txt2log" | Out-File -FilePath "$logFile" -Append
Invoke-Expression "$txt2log 2>&1 | Out-File -FilePath $logFile -Append"
if( $LASTEXITCODE -ne 0)
{
Write-Host "Error during cmmand: $txt2log" -ForegroundColor Red ;
@@ -53,27 +60,41 @@ function ExecuteLog($txt2log)
exit
}
}
# conf x logging
$filelog = "c:\Steamware\tmp\Script.log"
$utilDir = "c:\Steamware\tmp\"
Write-Output "-------------------------------- START script --------------------------------" | Out-File $filelog
# fix cartelle...
If (!(test-path $logFile))
{
New-Item -ItemType Directory -Force -Path $logDir
New-Item -ItemType File -Force -Path $logFile
New-Item -ItemType File -Force -Path $logMirror
}
Write-Output "-------------------------------- START script --------------------------------" | Out-File $logFile
$StopWatch = New-Object System.Diagnostics.Stopwatch
$StopWatch.Start()
# step 1 : stop del pool applicazioni IIS
Write-Host "Stop AppPool"
ExecuteLog "Stop-WebAppPool -Name '$AppPool'"
$currState = Get-WebAppPoolState -Name $AppPool
if($currState.value -eq "Started")
{
Write-Host "Stop AppPool"
ExecuteLog "Stop-WebAppPool -Name '$AppPool'"
}
# step 2 : unzip
ExecuteLog "Expand-7Zip -ArchiveFileName '$SourceDir\$ZipFile' -TargetPath '$utilDir'"
# step 2 : cambio dir + unzip
Write-Host "Unzip"
cd $utilDir
ExecuteLog "7z x ""$SourceDir\$ZipFile"" "
# step 3 : replica applicazione
Write-Host "START copy step"
ExecuteLog "robocopy '$utilDir\publish\net5.0\' '$DestDir' /MIR /Z /LOG:C:\tmp\ViewMirror.log /XF logs/*.txt logs/*.log"
ExecuteLog "robocopy '$utilDir\publish\net5.0\' '$DestDir' /MIR /Z /LOG:'$logMirror'"
Write-Host "END copy step"
# step 4 : riavvio pool
Write-Host "Start AppPool"
ExecuteLog "Start-WebAppPool -Name '$AppPool'"
# step 5 : fix dir originale
cd $installDir
+7 -1
View File
@@ -27,7 +27,7 @@ namespace MP.Data.Controllers
{
_configuration = configuration;
dbCtx = new MoonPro_STATSContext(configuration);
Log.Info("Avviata classe MpStatsController.MpStatsController");
Log.Info("Avviata classe MpStatsController");
}
#endregion Public Constructors
@@ -111,6 +111,12 @@ namespace MP.Data.Controllers
return dbResult;
}
public void ResetController()
{
dbCtx = new MoonPro_STATSContext(_configuration);
Log.Info("Effettuato reset MpStatsController");
}
/// <summary>
/// Annulla modifiche su una specifica entity (cancel update)
/// </summary>
+1 -1
View File
@@ -7,7 +7,7 @@
}
else
{
<div class="col-2 pr-0" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<ul class="list-group list-group-sm small">
@foreach (var item in @ParetoData)
{
+1 -1
View File
@@ -7,7 +7,7 @@
}
else
{
<div class="col-2 pr-0" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<ul class="list-group list-group-sm small">
@foreach (var item in @ParetoData)
{
+1 -1
View File
@@ -7,7 +7,7 @@
}
else
{
<div class="col-2 pr-0" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<ul class="list-group list-group-sm small">
@foreach (var item in @ParetoData)
{
+1 -1
View File
@@ -7,7 +7,7 @@
}
else
{
<div class="col-2 pr-0" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<div class="col-2" style="max-height: 10em; overflow:hidden; overflow-y: auto;">
<ul class="list-group list-group-sm small">
@foreach (var item in @ParetoData)
{
+39 -1
View File
@@ -10,6 +10,8 @@ using MP.Data;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json;
using System.Diagnostics;
using NLog;
namespace MP.Stats.Data
{
@@ -21,6 +23,7 @@ namespace MP.Stats.Data
private static ILogger<MpStatsService> _logger;
private static List<MP.Data.DatabaseModels.AzioniUL> ActionsList = new List<MP.Data.DatabaseModels.AzioniUL>();
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private readonly IDistributedCache distributedCache;
private readonly IMemoryCache memoryCache;
@@ -31,7 +34,7 @@ namespace MP.Stats.Data
/// <summary>
/// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa
/// NON estende oltre il tempo massimo di validità Abs della cache
/// NON estende oltre il tempo massimo di validità della cache (chAbsExp)
/// </summary>
private int chSliExp = 5;
@@ -116,10 +119,15 @@ namespace MP.Stats.Data
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.ActionsGetAll();
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per AzioniUL: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -187,10 +195,15 @@ namespace MP.Stats.Data
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.StatControlliGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per ResControlli: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -209,10 +222,15 @@ namespace MP.Stats.Data
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.StatDdbGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per DdbTurni: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -231,10 +249,15 @@ namespace MP.Stats.Data
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.StatOdlGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per ODL: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -253,10 +276,15 @@ namespace MP.Stats.Data
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.StatScartiGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per ResScarti: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -279,10 +307,15 @@ namespace MP.Stats.Data
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.StatTurniOeeGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per TurniOee: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
@@ -301,10 +334,15 @@ namespace MP.Stats.Data
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.StatUserLogGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
rawData = JsonConvert.SerializeObject(dbResult);
redisDataList = Encoding.UTF8.GetBytes(rawData);
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Info($"Effettuata lettura da DB + caching per UserActionLog: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
+10 -2
View File
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>1.0.2105.2620</Version>
</PropertyGroup>
<ItemGroup>
@@ -35,7 +36,11 @@
<PackageReference Include="Blazorise.Charts" Version="0.9.3.6" />
<PackageReference Include="Blazorise.Components" Version="0.9.3.6" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="0.9.3.6" />
<PackageReference Include="ElmahCore" Version="2.0.6" />
<PackageReference Include="ElmahCore.Common" Version="2.0.6" />
<PackageReference Include="ElmahCore.Sql" Version="2.0.6" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.12.0" />
</ItemGroup>
<ItemGroup>
@@ -43,4 +48,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
</Target>
</Project>
+46
View File
@@ -0,0 +1,46 @@
<?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"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue" />
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<logger name="*" minlevel="Trace" writeTo="fileTarget" />
</rules>
</nlog>
+3 -3
View File
@@ -158,11 +158,11 @@ namespace MP.Stats.Pages
MessageService.EA_SearchUpdated -= OnSeachUpdated;
}
public void OnSeachUpdated()
public async void OnSeachUpdated()
{
InvokeAsync(() =>
await InvokeAsync(() =>
{
UpdateData();
Task task = UpdateData();
StateHasChanged();
});
}
-35
View File
@@ -1,35 +0,0 @@
@page "/"
@namespace MP.Stats.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MP-STATS</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="MP-STATS.styles.css" rel="stylesheet" />
</head>
<body>
<component type="typeof(App)" render-mode="ServerPrerendered" />
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
+34 -6
View File
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Web;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,16 +12,43 @@ namespace MP.Stats
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
#region Public Methods
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
})
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
})
.UseNLog();
public static void Main(string[] args)
{
// inclusione NLog:
// https://github.com/NLog/NLog/wiki/Getting-started-with-ASP.NET-Core-5
// https://codewithmukesh.com/blog/logging-with-nlog-in-aspnet-core/
var logger = NLog.Web.NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger();
try
{
logger.Info("MP.STATS Application Starting Up");
CreateHostBuilder(args).Build().Run();
}
catch (Exception exception)
{
logger.Error(exception, "Stopped MP.STATS program because of exception");
throw;
}
finally
{
NLog.LogManager.Shutdown();
}
}
#endregion Public Methods
}
}
}
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\publish\net5.0\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
</PropertyGroup>
</Project>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PublishTargetUrl>C:\Users\samuele\source\repos\MAPO-CORE\MP.Stats\bin\publish\net5.0\</_PublishTargetUrl>
<History>True|2021-05-25T06:38:44.6280246Z;</History>
</PropertyGroup>
</Project>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAACFCXZ0UR7Czo59aaRCHU5QAAAAAASAAACgAAAAEAAAACYlKt9E6s77uEikpKwyhdQYAAAAUwae989LovFbsfjRp69HCVpyUQZbqLyYFAAAAMW8mLSAxWmKaOvB4nkDgUpS27/b</EncryptedPassword>
<History>True|2021-05-26T17:49:30.0427896Z;False|2021-05-26T19:49:14.9065510+02:00;True|2021-05-25T17:48:33.3901785+02:00;True|2021-05-25T17:46:09.2063020+02:00;True|2021-05-25T17:42:47.8167539+02:00;True|2021-05-25T17:22:03.1877438+02:00;True|2021-05-25T17:21:05.1565775+02:00;True|2021-05-25T16:26:34.1426996+02:00;True|2021-05-25T16:14:28.2842402+02:00;True|2021-05-25T15:02:11.7131495+02:00;</History>
</PropertyGroup>
</Project>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAAB3zVMW24A4himhWJ5CNqgeAAAAAASAAACgAAAAEAAAAA7IL1n8zHn2/ljDNL4/zlsYAAAAgAEg9RYKHV0xl3wnafZiN9Q954GOBAvdFAAAACSBJkwDndNTiIrUuk7zJls84fN1</EncryptedPassword>
<History>True|2021-05-26T17:49:44.3836006Z;</History>
</PropertyGroup>
</Project>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>d9901b50-e61c-400c-b62c-fa060cf72c29</ProjectGuid>
<DesktopBuildPackageLocation>bin\publish\MP.Stats.zip</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>Default Web Site/MP/STATS</DeployIisAppPath>
<TargetFramework>net5.0</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<History>True|2021-05-26T17:51:13.5051479Z;True|2021-05-26T19:51:04.9283608+02:00;True|2021-05-25T16:38:26.4142377+02:00;</History>
</PropertyGroup>
</Project>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA+11nhJeDSkeTlSej+COD3AAAAAACAAAAAAADZgAAwAAAABAAAADHiGtCyOetOyeT2xaFL+NDAAAAAASAAACgAAAAEAAAAAuYw1PbVDVdZhloQ7eVuTsYAAAAfA8iFmY49U48HUeRwWwQNsvZg5FRMf9SFAAAACB+0njgnTZ+1teEqoJcNV16idHL</EncryptedPassword>
<History>True|2021-05-26T17:49:56.4831784Z;True|2021-05-25T16:56:57.0194126+02:00;True|2021-05-24T18:44:45.5388713+02:00;True|2021-05-24T18:23:50.6056375+02:00;True|2021-05-24T18:01:51.1166144+02:00;True|2021-05-24T17:07:21.6348703+02:00;True|2021-05-24T17:07:10.8304877+02:00;True|2021-05-24T11:12:19.8440009+02:00;True|2021-05-24T11:12:08.1362921+02:00;True|2021-05-22T12:03:42.2864462+02:00;True|2021-05-21T19:54:05.6348108+02:00;False|2021-05-21T19:53:46.2134560+02:00;True|2021-05-21T08:11:55.5022811+02:00;True|2021-05-20T19:40:34.2462833+02:00;True|2021-05-20T19:40:10.3931366+02:00;True|2021-05-20T17:27:02.9543079+02:00;True|2021-05-20T16:59:12.4323448+02:00;True|2021-05-20T16:58:55.5021812+02:00;False|2021-05-20T16:58:03.5161910+02:00;True|2021-05-19T19:28:03.8104716+02:00;True|2021-05-18T19:48:52.9083044+02:00;True|2021-05-18T18:15:50.2374168+02:00;True|2021-05-18T18:06:20.0997789+02:00;True|2021-05-18T14:56:33.7479984+02:00;True|2021-05-17T17:03:39.9822588+02:00;True|2021-05-17T16:33:53.4419457+02:00;True|2021-05-17T16:33:10.5405414+02:00;False|2021-05-17T16:30:04.8648550+02:00;False|2021-05-17T16:29:49.5085445+02:00;</History>
</PropertyGroup>
</Project>
+18 -10
View File
@@ -1,20 +1,15 @@
using Blazorise;
using Blazorise.Bootstrap;
using Blazorise.Icons.FontAwesome;
using ElmahCore.Mvc;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MP.Stats.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Localization;
using System.Globalization;
using Blazorise;
using Blazorise.Bootstrap;
using Blazorise.Icons.FontAwesome;
namespace MP.Stats
{
@@ -62,6 +57,11 @@ namespace MP.Stats
FallBackToParentCultures = false
});
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT");
// Registrazione Elmah:
// https://github.com/ElmahCore/ElmahCore
app.UseElmah();
app.UseHttpsRedirection();
app.UseStaticFiles();
@@ -85,6 +85,14 @@ namespace MP.Stats
.AddBootstrapProviders()
.AddFontAwesomeIcons();
// Elmah
services.AddElmah();
//string elmaConn = "Data Source=SQL2016DEV;Initial Catalog=Elmah;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=SHERPA.BBM;";
//services.AddElmah<SqlErrorLog>(options =>
//{
// options.ConnectionString = elmaConn;
//});
services.AddStackExchangeRedisCache(options =>
{
options.Configuration = "localhost:6379";
+2 -2
View File
@@ -9,7 +9,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;MultipleActiveResultSets=true",
"Mp.Stats": "Server=SQL2016DEV;Database=MoonPro_STATS;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.STATS;"
"DefaultConnection": "Server=localhost\\SQLEXPRESS;Database=MoonPro_STATS;Trusted_Connection=True;MultipleActiveResultSets=true",
"Mp.Stats": "Server=localhost\\SQLEXPRESS;Database=MoonPro_STATS;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.STATS;"
}
}
-10
View File
@@ -1,10 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
+1 -1
View File
@@ -2,7 +2,7 @@
$MajMin="1.0."
$currentDate = get-date -format yyMM;
$currentTime = get-date -format HHmm;
$currentTime = get-date -format ddHH;
$find = "<Version>(.|\n)*?</Version>";
$replace = "<Version>" + $MajMin + $currentDate +"." + $currentTime + "</Version>";
$csproj = Get-Content $ProjectPath
+7 -1
View File
@@ -1,3 +1,9 @@
# MAPO-CORE
MAPO dotNet Core Web Project, repository progetti next gen su Blazor & co
MAPO dotNet Core Web Project, repository progetti next gen su Blazor & co
Applicazione multipiattaforma (gira su win, mac, linux), tramite IIS o altro.
## Installazione
Vedere pagina wiki x blazor: https://wiki.steamware.net/doku.php?id=blazor