Skip to content

Commit e8037c6

Browse files
authored
Merge pull request #1 from Jinhuafei/master
1.0.0 version
2 parents 050db7a + 2a77778 commit e8037c6

File tree

56 files changed

+5922
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+5922
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Oo]bj/
2+
[Bb]in/
3+
.vs/
4+
msbuild.*
5+
obj/
6+
packages/

.nuget/NuGet.Config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<solution>
4+
<add key="disableSourceControlIntegration" value="true" />
5+
</solution>
6+
<packageSources>
7+
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
8+
</packageSources>
9+
</configuration>

.nuget/NuGet.exe

18 KB
Binary file not shown.

.nuget/NuGet.targets

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
29+
<!-- Windows specific commands -->
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
</PropertyGroup>
32+
33+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
34+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
35+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
40+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
41+
</PropertyGroup>
42+
43+
<PropertyGroup>
44+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
45+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
49+
<!-- NuGet command -->
50+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
51+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
52+
53+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
54+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
55+
56+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
57+
58+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
59+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
60+
61+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
62+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
63+
64+
<!-- Commands -->
65+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
66+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
67+
68+
<!-- We need to ensure packages are restored prior to assembly resolve -->
69+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
70+
RestorePackages;
71+
$(BuildDependsOn);
72+
</BuildDependsOn>
73+
74+
<!-- Make the build depend on restore packages -->
75+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
76+
$(BuildDependsOn);
77+
BuildPackage;
78+
</BuildDependsOn>
79+
</PropertyGroup>
80+
81+
<Target Name="CheckPrerequisites">
82+
<!-- Raise an error if we're unable to locate nuget.exe -->
83+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
84+
<!--
85+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
86+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
87+
parallel builds will have to wait for it to complete.
88+
-->
89+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
90+
</Target>
91+
92+
<Target Name="_DownloadNuGet">
93+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
94+
</Target>
95+
96+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
97+
<Exec Command="$(RestoreCommand)"
98+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
99+
100+
<Exec Command="$(RestoreCommand)"
101+
LogStandardErrorAsError="true"
102+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
103+
</Target>
104+
105+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
106+
<Exec Command="$(BuildCommand)"
107+
Condition=" '$(OS)' != 'Windows_NT' " />
108+
109+
<Exec Command="$(BuildCommand)"
110+
LogStandardErrorAsError="true"
111+
Condition=" '$(OS)' == 'Windows_NT' " />
112+
</Target>
113+
114+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
115+
<ParameterGroup>
116+
<OutputFilename ParameterType="System.String" Required="true" />
117+
</ParameterGroup>
118+
<Task>
119+
<Reference Include="System.Core" />
120+
<Using Namespace="System" />
121+
<Using Namespace="System.IO" />
122+
<Using Namespace="System.Net" />
123+
<Using Namespace="Microsoft.Build.Framework" />
124+
<Using Namespace="Microsoft.Build.Utilities" />
125+
<Code Type="Fragment" Language="cs">
126+
<![CDATA[
127+
try {
128+
OutputFilename = Path.GetFullPath(OutputFilename);
129+
130+
Log.LogMessage("Downloading latest version of NuGet.exe...");
131+
WebClient webClient = new WebClient();
132+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
133+
134+
return true;
135+
}
136+
catch (Exception ex) {
137+
Log.LogErrorFromException(ex);
138+
return false;
139+
}
140+
]]>
141+
</Code>
142+
</Task>
143+
</UsingTask>
144+
</Project>

Microsoft.Aspnet.SessionState.sln

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{58E8143E-86D8-4CA3-AAC3-1CF253D91207}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{93AD624B-85A6-4EE9-B40E-42914D40C0CF}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync", "src\SqlSessionStateProviderAsync\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.csproj", "{493B0482-572A-4465-BD52-4094351C2647}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.SessionStateModule", "src\SessionStateModule\Microsoft.AspNet.SessionState.SessionStateModule.csproj", "{7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test", "test\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test.csproj", "{CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}"
15+
EndProject
16+
Global
17+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
18+
Debug|Any CPU = Debug|Any CPU
19+
Release|Any CPU = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{493B0482-572A-4465-BD52-4094351C2647}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{493B0482-572A-4465-BD52-4094351C2647}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{493B0482-572A-4465-BD52-4094351C2647}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{493B0482-572A-4465-BD52-4094351C2647}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{7238F90D-3BCE-4F40-A5BA-EA36AD484BD6}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2}.Release|Any CPU.Build.0 = Release|Any CPU
34+
EndGlobalSection
35+
GlobalSection(SolutionProperties) = preSolution
36+
HideSolutionNode = FALSE
37+
EndGlobalSection
38+
GlobalSection(NestedProjects) = preSolution
39+
{493B0482-572A-4465-BD52-4094351C2647} = {58E8143E-86D8-4CA3-AAC3-1CF253D91207}
40+
{7238F90D-3BCE-4F40-A5BA-EA36AD484BD6} = {58E8143E-86D8-4CA3-AAC3-1CF253D91207}
41+
{CBB00B6C-8A44-43F0-BE73-0B0E8565F8A2} = {93AD624B-85A6-4EE9-B40E-42914D40C0CF}
42+
EndGlobalSection
43+
EndGlobal

MicrosoftAspNetSessionState.msbuild

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Import Project="tools\MicrosoftAspNetSessionState.settings.targets"/>
3+
4+
<ItemGroup>
5+
<AssemblyProject Include="src\SessionStateModule\Microsoft.AspNet.SessionState.SessionStateModule.csproj" />
6+
<AssemblyProject Include="src\SqlSessionStateProviderAsync\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.csproj" />
7+
</ItemGroup>
8+
<ItemGroup Condition="'$(BuildCoreOnly)' != 'true'">
9+
<AssemblyProject Include="test\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test\Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync.Test.csproj" />
10+
</ItemGroup>
11+
<ItemGroup>
12+
<PackageProject Include="src\Packages\Packages.csproj" />
13+
</ItemGroup>
14+
15+
<Target Name="Build" DependsOnTargets="BuildAssemblies;BuildPackages" />
16+
<Target Name="Clean" DependsOnTargets="CleanPackages;CleanAssemblies" />
17+
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
18+
19+
<Target Name="BuildAssemblies" DependsOnTargets="RestorePackages">
20+
<MSBuild Targets="Build" Projects="@(AssemblyProject)" />
21+
</Target>
22+
23+
<Target Name="CleanAssemblies">
24+
<MSBuild Targets="Clean" Projects="Microsoft.Aspnet.SessionState.sln" />
25+
</Target>
26+
27+
<Target Name="RebuildAssemblies" DependsOnTargets="Clean;Build" />
28+
29+
<!-- Packages build -->
30+
31+
<Target Name="BuildPackages" DependsOnTargets="RestorePackages">
32+
<MSBuild Targets="" Projects="@(PackageProject)" />
33+
</Target>
34+
35+
<Target Name="CleanPackages">
36+
<MSBuild Targets="Clean" Projects="@(PackageProject)" />
37+
</Target>
38+
39+
<Target Name="RebuildPackages" DependsOnTargets="CleanPackages;BuildPackages" />
40+
41+
<Target Name="RestorePackages">
42+
<Exec Command=".nuget\NuGet.exe restore" />
43+
</Target>
44+
45+
<!--
46+
<Target Name="UnitTest">
47+
<ItemGroup>
48+
<TestDLLs Include="test\SystemWebProvidersUnitTest\bin\$(Configuration)\*Test.dll" />
49+
</ItemGroup>
50+
51+
<PropertyGroup>
52+
<TestSettingsFile Condition=" '$(Configuration)' == 'CodeCoverage' ">$(MsBuildProjectDirectory)\test\CodeCoverage.testsettings</TestSettingsFile>
53+
<TestSettingsFile Condition=" '$(Configuration)' != 'CodeCoverage' ">$(MsBuildProjectDirectory)\unittest.testsettings</TestSettingsFile>
54+
</PropertyGroup>
55+
56+
<Delete Files="bin\$(Configuration)-TestResults.trx" />
57+
<Exec
58+
Command="&quot;$(VS100COMNTOOLS)..\IDE\MSTEST.EXE&quot; /nologo /usestderr /resultsfile:&quot;bin\$(Configuration)-TestResults.trx&quot; @(TestDLLs -> '/testcontainer:&quot;%(Identity)&quot;', ' ') /testsettings:&quot;$(TestSettingsFile)&quot;" />
59+
</Target>
60+
-->
61+
<Import Project="tools\MicrosoftAspNetSessionState.targets"/>
62+
</Project>

build.cmd

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@ECHO OFF
2+
3+
setlocal
4+
5+
set logOptions=/flp:Summary;Verbosity=diag;LogFile=msbuild.log /flp1:warningsonly;logfile=msbuild.wrn /flp2:errorsonly;logfile=msbuild.err
6+
7+
set MSBUILDEXE=
8+
if exist "%SystemDrive%\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" (
9+
set MSBUILDEXE="%SystemDrive%\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
10+
GOTO BUILD
11+
)
12+
13+
if exist "%SystemDrive%\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" (
14+
set MSBUILDEXE="%SystemDrive%\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"
15+
GOTO BUILD
16+
)
17+
18+
if not defined MSBUILDEXE (
19+
set MSBUILDEXE="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
20+
)
21+
22+
:BUILD
23+
REM %MSBUILDEXE% "%~dp0\MicrosoftAspNetSessionState.msbuild" %logOptions% /v:d /maxcpucount /nodeReuse:false %*
24+
%MSBUILDEXE% "%~dp0\MicrosoftAspNetSessionState.msbuild" %logOptions% /v:diag /maxcpucount /nodeReuse:false %*
25+
26+
endlocal

src/SessionStateModule/AppSettings.cs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
namespace Microsoft.AspNet.SessionState
5+
{
6+
using System.Collections.Specialized;
7+
using System.Web.Configuration;
8+
9+
static class AppSettings
10+
{
11+
private static volatile bool _settingsInitialized;
12+
private static object _lock = new object();
13+
14+
private static void LoadSettings(NameValueCollection appSettings)
15+
{
16+
//
17+
// RequestQueueLimitPerSession
18+
//
19+
string requestQueueLimit = appSettings["aspnet:RequestQueueLimitPerSession"];
20+
21+
if (!int.TryParse(requestQueueLimit, out _requestQueueLimitPerSession) || _requestQueueLimitPerSession < 0)
22+
{
23+
_requestQueueLimitPerSession = DefaultRequestQueueLimitPerSession;
24+
}
25+
}
26+
27+
private static void EnsureSettingsLoaded()
28+
{
29+
if (_settingsInitialized)
30+
{
31+
return;
32+
}
33+
34+
lock (_lock)
35+
{
36+
if (!_settingsInitialized)
37+
{
38+
try
39+
{
40+
LoadSettings(WebConfigurationManager.AppSettings);
41+
}
42+
finally
43+
{
44+
_settingsInitialized = true;
45+
}
46+
}
47+
}
48+
}
49+
50+
//
51+
// RequestQueueLimitPerSession
52+
// Limit of queued requests per session
53+
//
54+
public const int DefaultRequestQueueLimitPerSession = 50;
55+
private static int _requestQueueLimitPerSession = DefaultRequestQueueLimitPerSession;
56+
57+
public static int RequestQueueLimitPerSession
58+
{
59+
get
60+
{
61+
EnsureSettingsLoaded();
62+
return _requestQueueLimitPerSession;
63+
}
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)