Permalink
Browse files

Added Web API tracing nuget

  • Loading branch information...
1 parent 1476fb3 commit 079c089448dd9109f0b2461c8105aa7e532b4312 @leastprivilege leastprivilege committed Sep 15, 2012
@@ -0,0 +1,41 @@
+using System;
+using System.Web.Http;
+using System.Web.Http.Tracing;
+
+namespace WebApiSecurity
+{
+ // TODO: To enable tracing in your application, please add the following line of code
+ // to your startup code (WebApiConfig.cs or Global.asax.cs in an MVC 4 project):
+ // TraceConfig.Register(config);
+ // For more information, refer to: http://www.asp.net/web-api
+
+ /// <summary>
+ /// This static class contains helper methods related to the registration
+ /// of <see cref="ITraceWriter"/> instances.
+ /// </summary>
+ public static class TraceConfig
+ {
+ /// <summary>
+ /// Registers the <see cref="ITraceWriter"/> implementation to use
+ /// for this application.
+ /// </summary>
+ /// <param name="configuration">The <see cref="HttpConfiguration"/> in which
+ /// to register the trace writer.</param>
+ public static void Register(HttpConfiguration configuration)
+ {
+ if (configuration == null)
+ {
+ throw new ArgumentNullException("configuration");
+ }
+
+ SystemDiagnosticsTraceWriter traceWriter =
+ new SystemDiagnosticsTraceWriter()
+ {
+ MinimumLevel = TraceLevel.Info,
+ IsVerbose = false
+ };
+
+ configuration.Services.Replace(typeof(ITraceWriter), traceWriter);
+ }
+ }
+}
@@ -17,6 +17,8 @@ protected void Application_Start()
AuthenticationConfig.ConfigureGlobal(GlobalConfiguration.Configuration);
DependencyConfig.Configure(GlobalConfiguration.Configuration);
CorsConfig.RegisterGlobal(GlobalConfiguration.Configuration);
+ TraceConfig.Register(GlobalConfiguration.Configuration);
+
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
@@ -11,9 +11,7 @@
providerName="System.Data.SqlClient"
connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebApiSecurity-20120603002037;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebApiSecurity-20120603002037.mdf" />
</connectionStrings>
-
<system.diagnostics configSource="tracing.config" />
-
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext"
value="true" />
@@ -52,7 +52,7 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Newtonsoft.Json.4.5.8\lib\net40\Newtonsoft.Json.dll</HintPath>
+ <HintPath>..\packages\Newtonsoft.Json.4.5.9\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -76,6 +76,9 @@
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll</HintPath>
</Reference>
+ <Reference Include="System.Web.Http.Tracing">
+ <HintPath>..\packages\Microsoft.AspNet.WebApi.Tracing.0.1.0-alpha-120814\lib\net40\System.Web.Http.Tracing.dll</HintPath>
+ </Reference>
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.20710.0\lib\net40\System.Web.Http.WebHost.dll</HintPath>
</Reference>
@@ -127,6 +130,7 @@
<Compile Include="App_Start\DependencyConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
+ <Compile Include="App_Start\TraceConfig.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
@@ -12,13 +12,14 @@
<package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net45" />
+ <package id="Microsoft.AspNet.WebApi.Tracing" version="0.1.0-alpha-120814" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.20710.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.jQuery.Unobtrusive.Ajax" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
<package id="Modernizr" version="2.5.3" targetFramework="net45" />
- <package id="Newtonsoft.Json" version="4.5.8" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="4.5.9" targetFramework="net45" />
<package id="WebGrease" version="1.1.0" targetFramework="net45" />
</packages>

0 comments on commit 079c089

Please sign in to comment.