riportati metodi MVC x velocizzare processing pagine servizio MP-IO (con redirect da pagine vecchie)

This commit is contained in:
Samuele E. Locatelli
2016-12-23 17:39:03 +01:00
parent d3e9aac130
commit 4d628145df
12 changed files with 229 additions and 73 deletions
Binary file not shown.
-52
View File
@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamWare", "..\..\Steamwar
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP-IO", "MP-IO\MP-IO.csproj", "{CE6CADA3-FA0E-41D6-AD43-8C92481DC29E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP-API", "MP-API\MP-API.csproj", "{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
218_SP|Any CPU = 218_SP|Any CPU
@@ -242,56 +240,6 @@ Global
{CE6CADA3-FA0E-41D6-AD43-8C92481DC29E}.Valgasket|Any CPU.Build.0 = IIS02|Any CPU
{CE6CADA3-FA0E-41D6-AD43-8C92481DC29E}.WinLab|Any CPU.ActiveCfg = IIS02|Any CPU
{CE6CADA3-FA0E-41D6-AD43-8C92481DC29E}.WinLab|Any CPU.Build.0 = IIS02|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.218_SP|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.218_SP|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.218_test|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.218_test|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Alumat|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Alumat|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.CMS|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.CMS|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.DEMO|Any CPU.ActiveCfg = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.DEMO|Any CPU.Build.0 = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.deploy|Any CPU.ActiveCfg = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.deploy|Any CPU.Build.0 = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Donati|Any CPU.ActiveCfg = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Donati|Any CPU.Build.0 = Debug|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.EQUA|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.EQUA|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.ETS|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.ETS|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.ETS-218|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.ETS-218|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS01_SP|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS01_SP|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS01_TK|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS01_TK|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS01|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS01|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS02_SP|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS02_SP|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS02_TK|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS02_TK|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS02|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.IIS02|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.MoonProDemo-OVH|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.MoonProDemo-OVH|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.OVH-demo|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.OVH-demo|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Release|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.SomaschiniUSA|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.SomaschiniUSA|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Steamware|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Steamware|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Valgasket|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.Valgasket|Any CPU.Build.0 = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.WinLab|Any CPU.ActiveCfg = Release|Any CPU
{DBA8D30F-006A-4EDE-9D9B-A50A363098B5}.WinLab|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+4 -1
View File
@@ -11,9 +11,12 @@ namespace MP_IO
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect("IOB");
#if false
Response.Clear();
Response.Write("OK");
Context.Response.End();
Context.Response.End();
#endif
}
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace MP_IO
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
+87
View File
@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MapoDb;
namespace MP_IO.Controllers
{
public class IOBController : Controller
{
// GET: IOB (è un check alive)
public string Index()
{
return "OK";
}
// disabilitato: non vale la pena
//// GET: IOB/enabled/5 - tenuta in cache per 5 sec...
//[OutputCache(Duration = 5, VaryByParam = "id")]
// GET: IOB/enabled/5
public string enabled(int? id)
{
string answ = "ND";
// se id nullo --> KO!
if (id == null)
{
answ = "KO";
}
else
{
int idx = 0;
Int32.TryParse(id.ToString(), out idx);
// verifico se sia abilitato INSERT x una data macchina
if (MapoDb.MapoDb.obj.insEnabled(idx))
{
answ = "OK";
}
else
{
answ = "NO";
}
}
return answ;
}
// GET: IOB/slog/5
public string slog(int? id)
{
string answ = "ND";
// se id nullo --> KO!
if (id == null)
{
answ = "KO";
}
else
{
int idx = 0;
Int32.TryParse(id.ToString(), out idx);
// verifico se sia abilitato SignalLog x una data macchina
if (MapoDb.MapoDb.obj.sLogEnabled(idx))
{
answ = "OK";
}
else
{
answ = "NO";
}
}
return answ;
}
// GET: IOB/input/5
public string input(int? id)
{
string answ = "OK " + id.ToString();
// controllo se sia da fare rilettura da DB dello stato macchina ( SE non c'è il valore oppure se il valore "maxAgeSec" è stato superato )
// verifico se sia abilitato INSERT x una data macchina
// cerco prima in cache memory (altrimenti la popolo da DB)
return answ;
}
}
}
+1
View File
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="MP_IO.WebApiApplication" Language="C#" %>
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
//using System.Web.Http;
using System.Web.Mvc;
//using System.Web.Optimization;
using System.Web.Routing;
namespace MP_IO
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
//GlobalConfiguration.Configure(WebApiConfig.Register);
//FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
//BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
+35
View File
@@ -43,6 +43,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
@@ -53,6 +57,30 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
@@ -63,6 +91,7 @@
<Content Include="Alive.aspx" />
<Content Include="Default.aspx" />
<Content Include="enabled.aspx" />
<Content Include="Global.asax" />
<Content Include="images\macchine\Combi_A.jpg" />
<Content Include="images\macchine\Combi_B.jpg" />
<Content Include="images\macchine\Combi_C.jpg" />
@@ -105,6 +134,8 @@
<Compile Include="Alive.aspx.designer.cs">
<DependentUpon>Alive.aspx</DependentUpon>
</Compile>
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\IOBController.cs" />
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -119,6 +150,9 @@
<Compile Include="enabled.aspx.designer.cs">
<DependentUpon>enabled.aspx</DependentUpon>
</Compile>
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="inputIOB.aspx.cs">
<DependentUpon>inputIOB.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -158,6 +192,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="logs\PlaceHolder.file" />
<Content Include="packages.config" />
<None Include="Properties\PublishProfiles\IIS01.pubxml" />
<None Include="Properties\PublishProfiles\IIS02.pubxml" />
<None Include="Properties\PublishProfiles\Steamware.pubxml" />
+41 -18
View File
@@ -6,29 +6,36 @@
<configuration>
<appSettings>
<!--gestione timeout "esteso" x chiamate SQL critiche, in secondi -->
<add key="sqlLongCommandTimeout" value="600" />
<add key="sqlLongCommandTimeout" value="600"/>
<!--keep alive!-->
<add key="forceResetKeepAlive" value="true" />
<add key="forceResetKeepAlive" value="true"/>
<!--conf base-->
<add key="appName" value="MP-IO" />
<add key="appName" value="MP-IO"/>
<!-- Logging -->
<add key="_logDir" value="~/logs/" />
<add key="_logLevel" value="7" />
<add key="_logMaxMb" value="30" />
<add key="_logDir" value="~/logs/"/>
<add key="_logLevel" value="7"/>
<add key="_logMaxMb" value="30"/>
<!--KeepAlive settings-->
<add key="kaMinUpdSec" value="45" />
<add key="kaMinUpdSec" value="45"/>
<!--stringhe connessione-->
<add key="MoonProConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="PermessiConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="UtenteCdcConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=Donati_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="VocabolarioConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="DevicesConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=Donati_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="MoonProConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer"/>
<add key="PermessiConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer"/>
<add key="UtenteCdcConnectionString"
value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=Donati_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer"/>
<add key="VocabolarioConnectionString"
value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer"/>
<add key="DevicesConnectionString"
value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=Donati_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer"/>
<!--gestione charting-->
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;"/>
</appSettings>
<connectionStrings>
<add name="MoonProConnectionString" connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
<add name="MoonProConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient"/>
<add name="MapoDb.Properties.Settings.MoonProConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
@@ -39,11 +46,27 @@
</system.Web>
-->
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime />
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime/>
<pages controlRenderingCompatibilityVersion="4.0">
</pages>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+4 -1
View File
@@ -18,6 +18,8 @@ namespace MP_IO
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect(string.Format("IOB/enabled/{0}", Request.QueryString["idxMacchina"]));
#if false
// legge i get x processare la seriale
int idxMacchina = 0;
bool enabled = false;
@@ -63,7 +65,8 @@ namespace MP_IO
// ripulisco pagina restituita e tolgo html (solo codice ok/NO)
Response.Clear();
Response.Write(answ);
Context.Response.End();
Context.Response.End();
#endif
}
}
}
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
</packages>
+4 -1
View File
@@ -12,6 +12,8 @@ namespace MP_IO
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect(string.Format("IOB/slog/{0}", Request.QueryString["idxMacchina"]));
#if false
// legge i get x processare la seriale
int idxMacchina = 0;
bool enabled = false;
@@ -57,7 +59,8 @@ namespace MP_IO
// ripulisco pagina restituita e tolgo html (solo codice ok/NO)
Response.Clear();
Response.Write(answ);
Context.Response.End();
Context.Response.End();
#endif
}
}
}