Porting API a Blazor 8
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
<None Include="Properties\PublishProfiles\IIS02.pubxml.user" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.14" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.12" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.8.12" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="9.1.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="9.1.0" />
|
||||
|
||||
+10
-17
@@ -2,6 +2,8 @@ using GPW.CORE.Api.Data;
|
||||
using GPW.CORE.Data;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using StackExchange.Redis;
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
@@ -10,6 +12,11 @@ using System.Text.Json.Serialization;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var logger = LogManager.Setup()
|
||||
.LoadConfigurationFromAppSettings()
|
||||
.GetCurrentClassLogger();
|
||||
logger.Info("Program.cs: startup");
|
||||
|
||||
// configuration setup
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
// Redis
|
||||
@@ -18,6 +25,7 @@ string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"))
|
||||
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
logger.Info("Conf Redis completata");
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
@@ -39,27 +47,11 @@ builder.Services.Configure<MailKitEmailSenderOptions>(options =>
|
||||
options.Sender_Name = configuration["ExternalProviders:MailKit:SMTP:SenderName"] ?? "";
|
||||
});
|
||||
|
||||
builder.Services.AddStackExchangeRedisCache(options =>
|
||||
{
|
||||
configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
//options.Configuration = configuration.GetSection("Redis").GetConnectionString("Redis");
|
||||
});
|
||||
logger.Info("Conf Email completata");
|
||||
|
||||
builder.Services.AddControllers()
|
||||
.AddJsonOptions(c => c.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.Preserve);
|
||||
|
||||
builder.Services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>((options) =>
|
||||
{
|
||||
List<RedisConfiguration> newConf = new List<RedisConfiguration>();
|
||||
var currConf = configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
if (currConf != null)
|
||||
{
|
||||
newConf.Add(currConf);
|
||||
}
|
||||
return newConf;
|
||||
//return configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton<ApiDataService>();
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
|
||||
@@ -93,4 +85,5 @@ app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
logger.Info("App run!");
|
||||
app.Run();
|
||||
|
||||
@@ -5,9 +5,52 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"NLog": {
|
||||
"variables": {
|
||||
"baseFileDir": "${basedir}/logs/",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
|
||||
},
|
||||
// "internalLogLevel": "Info",
|
||||
// "internalLogFile": "c:\\temp\\internal-nlog.txt",
|
||||
"extensions": [
|
||||
{ "assembly": "NLog.Extensions.Logging" },
|
||||
{ "assembly": "NLog.Web.AspNetCore" }
|
||||
],
|
||||
"throwConfigExceptions": true,
|
||||
"targets": {
|
||||
"async": true,
|
||||
"logfile": {
|
||||
"type": "File",
|
||||
"fileName": "${basedir}/logs/${shortdate}.log",
|
||||
"archiveEvery": "Day",
|
||||
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
|
||||
"archiveNumbering": "DateAndSequence",
|
||||
"archiveAboveSize": "1024000",
|
||||
"archiveDateFormat": "HH",
|
||||
"maxArchiveFiles": "60",
|
||||
"maxArchiveDays": "30"
|
||||
},
|
||||
"logconsole": {
|
||||
"type": "ColoredConsole",
|
||||
"layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}"
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Trace",
|
||||
"writeTo": "logconsole"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"writeTo": "logfile"
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"GPW.DB": "Server=W2019-SQL-STEAM;Database=GPW;User ID=UserGPW; Password=Us3rGpw!75x93$77;integrated security=False;MultipleActiveResultSets=True;App=LiMan.API;",
|
||||
"GPW.DB": "Server=W2019-SQL-STEAM; Database=GPW; User ID=UserGPW; Password=Us3rGpw!75x93$77; integrated security=False; MultipleActiveResultSets=True;App=LiMan.API; TrustServerCertificate=True;",
|
||||
"Redis": "localhost:26379,serviceName=prod,DefaultDatabase=15,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG"
|
||||
},
|
||||
"ExternalProviders": {
|
||||
|
||||
@@ -26,6 +26,24 @@
|
||||
<Routes @rendermode=RenderMode.InteractiveServer />
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
|
||||
@* Gestione Blazor 6 x autoreconnect, da valutare *@
|
||||
@* <script src="_framework/blazor.server.js" autostart="false"></script>
|
||||
<script>
|
||||
Blazor.start({
|
||||
reconnectionOptions: {
|
||||
maxRetries: 3600,
|
||||
retryIntervalMilliseconds: 1000
|
||||
},
|
||||
}).then(() => {
|
||||
Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
|
||||
console.log("Client reconnected, waiting 5 sec and reload!");
|
||||
setTimeout(function () {
|
||||
document.location.reload();
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
</script> *@
|
||||
|
||||
<script type="text/javascript" src="lib/bootstrap/js/bootstrap.min.js"></script>
|
||||
@* <script type="text/javascript" src="lib/font-awesome/js/all.min.js"></script> *@
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish>https://office.egalware.com/GPW/CORE.WRKLOG</SiteUrlToLaunchAfterPublish>
|
||||
<SiteUrlToLaunchAfterPublish>https://office.egalware.com/GPW/CORE.WRKLOG8</SiteUrlToLaunchAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<ProjectGuid>e4229ee4-ed4f-4507-8058-b01dc3ca1b28</ProjectGuid>
|
||||
<SelfContained>false</SelfContained>
|
||||
<MSDeployServiceURL>https://office.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
|
||||
<DeployIisAppPath>office.egalware.com/GPW/CORE.WRKLOG</DeployIisAppPath>
|
||||
<DeployIisAppPath>office.egalware.com/GPW/CORE.WRKLOG8</DeployIisAppPath>
|
||||
<RemoteSitePhysicalPath />
|
||||
<SkipExtraFilesOnServer>true</SkipExtraFilesOnServer>
|
||||
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
|
||||
@@ -22,6 +22,6 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
|
||||
<UserName>jenkins</UserName>
|
||||
<_SavePWD>true</_SavePWD>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -7,7 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
<PropertyGroup>
|
||||
<TimeStampOfAssociatedLegacyPublishXmlFile />
|
||||
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAw3dMMgC4FUywyOTV2xvCRgAAAAACAAAAAAADZgAAwAAAABAAAADrbAogtj/xpZqylbgs9Hb3AAAAAASAAACgAAAAEAAAAFm1lcdH7oj+NFy4QgZ7q18YAAAAROPsyRR12dhPTKfMEQ5yNCAZJ5K7C4pvFAAAAEFBVTwItjyYP2BlOTsuK1g9myQ8</EncryptedPassword>
|
||||
<History>True|2023-04-11T08:12:15.0154900Z;False|2023-04-11T10:11:47.1977827+02:00;True|2023-04-11T09:18:55.4555319+02:00;True|2023-04-11T09:16:05.8827677+02:00;True|2022-06-06T12:56:03.5790550+02:00;False|2022-06-06T12:54:19.4739620+02:00;False|2022-06-06T12:53:46.4246554+02:00;</History>
|
||||
<History>True|2024-09-04T16:21:49.9717603Z||;True|2023-04-11T10:12:15.0154900+02:00||;False|2023-04-11T10:11:47.1977827+02:00||;True|2023-04-11T09:18:55.4555319+02:00||;True|2023-04-11T09:16:05.8827677+02:00||;True|2022-06-06T12:56:03.5790550+02:00||;False|2022-06-06T12:54:19.4739620+02:00||;False|2022-06-06T12:53:46.4246554+02:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user