diff --git a/MP-IO/App_Readme/Elmah.txt b/MP-IO/App_Readme/Elmah.txt new file mode 100644 index 00000000..784b3094 --- /dev/null +++ b/MP-IO/App_Readme/Elmah.txt @@ -0,0 +1,15 @@ +A new HTTP handler has been configured in your application for consulting the +error log and its feeds. It is reachable at elmah.axd under your application +root. If, for example, your application is deployed at http://www.example.com, +the URL for ELMAH would be http://www.example.com/elmah.axd. You can, of +course, change this path in your application's configuration file. + +ELMAH is also set up to be secure such that it can only be accessed locally. +You can enable remote access but then it is paramount that you secure access +to authorized users or/and roles only. This can be done using standard +authorization rules and configuration already built into ASP.NET. For more +information, see http://code.google.com/p/elmah/wiki/SecuringErrorLogPages on +the project site. + +Please review the commented out authorization section under + and make the appropriate changes. diff --git a/MP-IO/App_Start/WebApiConfig.cs b/MP-IO/App_Start/WebApiConfig.cs new file mode 100644 index 00000000..82161890 --- /dev/null +++ b/MP-IO/App_Start/WebApiConfig.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; + +namespace MP_IO.App_Start +{ + public static class WebApiConfig + { + public static void Register(HttpConfiguration config) + { + // Servizi e configurazione dell'API Web + + // Route dell'API Web + config.MapHttpAttributeRoutes(); + + config.Routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + } + } +} \ No newline at end of file diff --git a/MP-IO/Controllers/WebAPI/IOBController.cs b/MP-IO/Controllers/WebAPI/IOBController.cs new file mode 100644 index 00000000..53aa3c8b --- /dev/null +++ b/MP-IO/Controllers/WebAPI/IOBController.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; + +namespace MP_IO.Controllers.WebAPI +{ + public class IOBController : ApiController + { + // GET api/IOB + //[ResponseCache(Duration = 10)] + [HttpGet] + public string Get() + { + return "OK"; + } + + // GET api//5 + public string Get(int id) + { + return "value"; + } + + // POST api/ + public void Post([FromBody]string value) + { + } + + // PUT api//5 + public void Put(int id, [FromBody]string value) + { + } + + // DELETE api//5 + public void Delete(int id) + { + } + } +} \ No newline at end of file diff --git a/MP-IO/Global.asax.cs b/MP-IO/Global.asax.cs index 605f4d0b..b60e2b04 100644 --- a/MP-IO/Global.asax.cs +++ b/MP-IO/Global.asax.cs @@ -1,18 +1,21 @@ -using System.Web.Mvc; +using MP_IO.App_Start; +using System.Web.Http; +using System.Web.Mvc; using System.Web.Routing; namespace MP_IO { - public class WebApiApplication : System.Web.HttpApplication - { - protected void Application_Start() + public class WebApiApplication : System.Web.HttpApplication { - // Codice eseguito all'avvio dell'applicazione - AreaRegistration.RegisterAllAreas(); - RouteConfig.RegisterRoutes(RouteTable.Routes); + protected void Application_Start() + { + // Codice eseguito all'avvio dell'applicazione + AreaRegistration.RegisterAllAreas(); + GlobalConfiguration.Configure(WebApiConfig.Register); + RouteConfig.RegisterRoutes(RouteTable.Routes); - // avvio il metodo init x applicazione... - MP_Startup.Init(); + // avvio il metodo init x applicazione... + MP_Startup.Init(); + } } - } } diff --git a/MP-IO/MP-IO.csproj b/MP-IO/MP-IO.csproj index 90e369f3..90a79765 100644 --- a/MP-IO/MP-IO.csproj +++ b/MP-IO/MP-IO.csproj @@ -57,6 +57,9 @@ ..\packages\DnsClient.1.2.0\lib\net45\DnsClient.dll + + ..\packages\elmah.corelibrary.1.2.2\lib\Elmah.dll + ..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll @@ -127,6 +130,10 @@ ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll @@ -160,6 +167,12 @@ ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll + ..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll @@ -183,12 +196,15 @@ + - + + Always + @@ -256,8 +272,10 @@ + + default.aspx ASPXCodeBehind diff --git a/MP-IO/Web.config b/MP-IO/Web.config index 555713c6..f3127a01 100644 --- a/MP-IO/Web.config +++ b/MP-IO/Web.config @@ -4,325 +4,379 @@ http://go.microsoft.com/fwlink/?LinkId=169433 --> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MP-IO/favicon.ico b/MP-IO/favicon.ico index 4f0e0ad0..daacbc8c 100644 Binary files a/MP-IO/favicon.ico and b/MP-IO/favicon.ico differ diff --git a/MP-IO/packages.config b/MP-IO/packages.config index c356d0a0..c5f4623b 100644 --- a/MP-IO/packages.config +++ b/MP-IO/packages.config @@ -4,6 +4,8 @@ + + @@ -12,6 +14,13 @@ + + + + + + +