Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
<Reference Include="Microsoft.Web.Optimization">
<HintPath>..\packages\Microsoft.Web.Optimization.0.1\lib\net40\Microsoft.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="Nancy">
<HintPath>..\packages\Nancy.0.12.0\lib\net40\Nancy.dll</HintPath>
</Reference>
<Reference Include="Nancy.Hosting.Aspnet">
<HintPath>..\packages\Nancy.Hosting.Aspnet.0.12.0\lib\net40\Nancy.Hosting.Aspnet.dll</HintPath>
</Reference>
<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>
Expand Down Expand Up @@ -121,6 +127,7 @@
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\MvcPerformanceController.cs" />
<Compile Include="nancy\NancyPerformanceModule.cs" />
<Compile Include="Controllers\Person.cs" />
<Compile Include="Controllers\WebApiPerformance.cs" />
<Compile Include="Global.asax.cs">
Expand Down
4 changes: 4 additions & 0 deletions AspNetFrameworksPerformance/Global.asax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ protected void Application_Start()
var formatters = GlobalConfiguration.Configuration.Formatters;
formatters.Remove(formatters.XmlFormatter);

RouteTable.Routes.Ignore("nancy/{*pathInfo}");

// API route - make sure this gets defined *BEFORE* MVC routes
RouteTable.Routes.MapHttpRoute(
name: "WebApiPerformanceAction",
Expand All @@ -33,8 +35,10 @@ protected void Application_Start()
}
);


FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);

//BundleConfig.RegisterBundles(BundleTable.Bundles);

}
Expand Down
24 changes: 22 additions & 2 deletions AspNetFrameworksPerformance/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="false" targetFramework="4.0" />
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
Expand All @@ -28,7 +28,7 @@
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="Westwind.Utilities" />
Expand All @@ -41,12 +41,16 @@
<httpModules>
<add name="ScriptCompressionModule" type="Westwind.Web.ScriptCompressionModule,Westwind.Web" />
</httpModules>
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add path="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" verb="*"/>
</handlers>
<modules>
<add name="ScriptCompressionModule" type="Westwind.Web.ScriptCompressionModule,Westwind.Web" />
Expand Down Expand Up @@ -87,4 +91,20 @@
</service>
</services>
</system.serviceModel>
<location path="nancy">
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*"/>
</httpHandlers>
</system.web>

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*"/>
</handlers>
</system.webServer>
</location>
</configuration>
31 changes: 31 additions & 0 deletions AspNetFrameworksPerformance/nancy/NancyPerformanceModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;

namespace AspNetFrameworksPerformance.Controllers
{
public class NancyPerformanceModule : NancyModule
{
public NancyPerformanceModule()
: base("/nancy")
{
Get["/"] = _ =>
{
return "Hello Nancy";
};

//Get["/NancyFx/HelloWorldCode"] = _ =>
Get["/HelloWorldCode"] = _ =>
{
return "Hello World. Time is: " + DateTime.Now.ToString();
};

Get["/HelloWorldJson"] = _ =>
{
return Response.AsJson(new Person());
};
}
}
}
2 changes: 2 additions & 0 deletions AspNetFrameworksPerformance/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
<package id="Microsoft.Web.Optimization" version="0.1" targetFramework="net40" />
<package id="Nancy" version="0.12.0" targetFramework="net40" />
<package id="Nancy.Hosting.Aspnet" version="0.12.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.8" targetFramework="net40" />
<package id="Westwind.Utilities" version="1.20" targetFramework="net40" />
<package id="Westwind.Web" version="1.201" targetFramework="net40" />
Expand Down
2 changes: 2 additions & 0 deletions LoadTests/ab_PerfTests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ ab.exe -n100000 -c20 http://localhost/AspNetPerf/WcfService.svc/HelloWorld > Wcf
ab.exe -n100000 -c20 http://localhost/aspnetperf/MvcPerformance/HelloWorldCode > Mvc.txt
ab.exe -n100000 -c20 http://localhost/aspnetperf/api/HelloWorld > WebApi.txt
ab.exe -n100000 -c20 http://localhost/AspNetPerf/WestWindCallbackHandler.ashx?Method=HelloWorld > WestWindCallback.txt
ab.exe -n100000 -c20 http://localhost/AspNetPerf/nancy/HelloWorldCode > NancyCode.txt

REM JSON RESPONSES
ab.exe -n100000 -c20 http://localhost/aspnetperf/Handler.ashx?action=json > HandlerJson.txt
ab.exe -n100000 -c20 http://localhost/aspnetperf/MvcPerformance/HelloWorldJson > MvcJson.txt
ab.exe -n100000 -c20 http://localhost/aspnetperf/api/HelloWorldJson > WebApiJson.txt
ab.exe -n100000 -c20 http://localhost/AspNetPerf/WcfService.svc/HelloWorldJson > WcfJson.txt
ab.exe -n100000 -c20 http://localhost/AspNetPerf/WestWindCallbackHandler.ashx?Method=HelloWorldJson > WestWindCallbackJson.txt
ab.exe -n100000 -c20 http://localhost/AspNetPerf/nancy/HelloWorldCode > NancyJson.txt

pause