Merge branch 'release/2.2'
This commit is contained in:
commit
e8d898dcd9
|
|
@ -9,12 +9,10 @@
|
|||
<ItemGroup>
|
||||
<RepositoryBuildOrder Include="AADIntegration" Order="15" />
|
||||
<RepositoryBuildOrder Include="Identity" Order="15" />
|
||||
<RepositoryBuildOrder Include="JavaScriptServices" Order="15" />
|
||||
<RepositoryBuildOrder Include="AzureIntegration" Order="15" />
|
||||
<RepositoryBuildOrder Include="MusicStore" Order="16" />
|
||||
<RepositoryBuildOrder Include="SignalR" Order="16" />
|
||||
<RepositoryBuildOrder Include="AuthSamples" Order="16" />
|
||||
<RepositoryBuildOrder Include="Components" Order="17" />
|
||||
<RepositoryBuildOrder Include="Templating" Order="18" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -38,9 +38,7 @@
|
|||
<ItemGroup>
|
||||
<Repository Include="AADIntegration" />
|
||||
<Repository Include="AzureIntegration" />
|
||||
<Repository Include="Components" />
|
||||
<Repository Include="Identity" />
|
||||
<Repository Include="JavaScriptServices" />
|
||||
<Repository Include="SignalR" />
|
||||
<Repository Include="Templating" PatchPolicy="AlwaysUpdateAndCascadeVersions" />
|
||||
|
||||
|
|
|
|||
|
|
@ -39,19 +39,6 @@
|
|||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.AspNetCoreModuleV2' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Authentication-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authentication' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authentication' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Authentication.Core" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.DataProtection" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.WebEncoders" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Authentication.Abstractions-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authentication.Abstractions' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -138,13 +125,18 @@
|
|||
<BaselinePackageReference Include="Microsoft.IdentityModel.Protocols.WsFederation" Version="[5.3.0, )" />
|
||||
<BaselinePackageReference Include="System.IdentityModel.Tokens.Jwt" Version="[5.3.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Authorization-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authorization' ">
|
||||
<!-- Package: Microsoft.AspNetCore.Authentication-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authentication' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authorization' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authentication' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Authentication.Core" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.DataProtection" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.WebEncoders" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Authorization.Policy-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authorization.Policy' ">
|
||||
|
|
@ -154,6 +146,14 @@
|
|||
<BaselinePackageReference Include="Microsoft.AspNetCore.Authorization" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Authentication.Abstractions" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Authorization-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authorization' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Authorization' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Connections.Abstractions-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Connections.Abstractions' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -162,6 +162,15 @@
|
|||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http.Features" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="System.IO.Pipelines" Version="[4.5.2, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.CookiePolicy-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.CookiePolicy' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.CookiePolicy' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Cors-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Cors' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -173,15 +182,6 @@
|
|||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.CookiePolicy-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.CookiePolicy' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.CookiePolicy' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Cryptography.Internal-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Cryptography.Internal' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -542,6 +542,18 @@
|
|||
<BaselinePackageReference Include="Microsoft.Extensions.DependencyInjection" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Localization" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Mvc.Razor.Extensions-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc.Razor.Extensions' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc.Razor.Extensions' AND '$(TargetFramework)' == 'net46' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Razor" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc.Razor.Extensions' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Razor" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Mvc.Razor-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc.Razor' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -606,18 +618,6 @@
|
|||
<BaselinePackageReference Include="Microsoft.Extensions.WebEncoders" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Newtonsoft.Json.Bson" Version="[1.0.1, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Mvc.Razor.Extensions-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc.Razor.Extensions' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc.Razor.Extensions' AND '$(TargetFramework)' == 'net46' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Razor" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc.Razor.Extensions' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Razor" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Mvc-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Mvc' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -637,6 +637,15 @@
|
|||
<BaselinePackageReference Include="Microsoft.Extensions.Caching.Memory" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.DependencyInjection" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.NodeServices-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.NodeServices' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.NodeServices' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Console" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Newtonsoft.Json" Version="[11.0.2, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Owin-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Owin' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -644,13 +653,6 @@
|
|||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Owin' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Http" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Razor-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Razor' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Razor' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Razor.Design-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Razor.Design' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -670,6 +672,13 @@
|
|||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.Razor-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Razor' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Razor' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Html.Abstractions" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.ResponseCaching.Abstractions-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.ResponseCaching.Abstractions' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -884,6 +893,25 @@
|
|||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.SpaServices.Extensions-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.SpaServices.Extensions' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.SpaServices.Extensions' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.SpaServices" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.WebSockets" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.SpaServices-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.SpaServices' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.SpaServices' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.NodeServices" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Mvc.TagHelpers" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore.StaticFiles-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.StaticFiles' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -921,21 +949,6 @@
|
|||
<BaselinePackageReference Include="Microsoft.Net.Http.Headers" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="System.Text.Encodings.Web" Version="[4.5.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.CodeAnalysis.Razor-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.CodeAnalysis.Razor' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.CodeAnalysis.Razor' AND '$(TargetFramework)' == 'net46' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="[2.8.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Common" Version="[2.8.0, )" />
|
||||
<BaselinePackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="[4.3.0, )" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.CodeAnalysis.Razor' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="[2.8.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Common" Version="[2.8.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.AspNetCore-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
@ -960,6 +973,21 @@
|
|||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Debug" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.Extensions.Logging.EventSource" Version="[2.2.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.CodeAnalysis.Razor-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.CodeAnalysis.Razor' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.CodeAnalysis.Razor' AND '$(TargetFramework)' == 'net46' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="[2.8.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Common" Version="[2.8.0, )" />
|
||||
<BaselinePackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="[4.3.0, )" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.CodeAnalysis.Razor' AND '$(TargetFramework)' == 'netstandard2.0' ">
|
||||
<BaselinePackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="[2.2.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="[2.8.0, )" />
|
||||
<BaselinePackageReference Include="Microsoft.CodeAnalysis.Common" Version="[2.8.0, )" />
|
||||
</ItemGroup>
|
||||
<!-- Package: Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore-->
|
||||
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore' ">
|
||||
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ build of ASP.NET Core 2.2.x. Update this list when preparing for a new patch.
|
|||
<Package Id="Microsoft.AspNetCore.Antiforgery" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.AspNetCoreModule" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.AspNetCoreModuleV2" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authentication.Abstractions" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authentication.Core" Version="2.2.0" />
|
||||
|
|
@ -24,11 +23,12 @@ build of ASP.NET Core 2.2.x. Update this list when preparing for a new patch.
|
|||
<Package Id="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authentication.Twitter" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authentication.WsFederation" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authorization" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authorization.Policy" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Authorization" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Connections.Abstractions" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Cors" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.CookiePolicy" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Cors" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Cryptography.Internal" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.DataProtection.Abstractions" Version="2.2.0" />
|
||||
|
|
@ -68,18 +68,19 @@ build of ASP.NET Core 2.2.x. Update this list when preparing for a new patch.
|
|||
<Package Id="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.Localization" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.Razor" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.RazorPages" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.TagHelpers" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc.Razor.Extensions" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.NodeServices" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Owin" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Razor" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Razor.Language" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Razor.Runtime" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Razor" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.ResponseCaching.Abstractions" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.ResponseCaching" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.ResponseCompression" Version="2.2.0" />
|
||||
|
|
@ -96,12 +97,14 @@ build of ASP.NET Core 2.2.x. Update this list when preparing for a new patch.
|
|||
<Package Id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.Session" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.SpaServices.Extensions" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.SpaServices" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.WebSockets" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
|
||||
<Package Id="Microsoft.CodeAnalysis.Razor" Version="2.2.0" />
|
||||
<Package Id="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<Package Id="Microsoft.CodeAnalysis.Razor" Version="2.2.0" />
|
||||
<Package Id="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="2.2.0" />
|
||||
<Package Id="Microsoft.Net.Http.Headers" Version="2.2.0" />
|
||||
<Package Id="Microsoft.Net.Sdk.Razor" Version="2.2.0" />
|
||||
|
|
|
|||
|
|
@ -77,11 +77,14 @@
|
|||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Localization.Routing" ProjectPath="$(RepositoryRoot)src\Middleware\Localization.Routing\src\Microsoft.AspNetCore.Localization.Routing.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Localization" ProjectPath="$(RepositoryRoot)src\Middleware\Localization\src\Microsoft.AspNetCore.Localization.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.MiddlewareAnalysis" ProjectPath="$(RepositoryRoot)src\Middleware\MiddlewareAnalysis\src\Microsoft.AspNetCore.MiddlewareAnalysis.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.NodeServices" ProjectPath="$(RepositoryRoot)src\Middleware\NodeServices\src\Microsoft.AspNetCore.NodeServices.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.ResponseCaching.Abstractions" ProjectPath="$(RepositoryRoot)src\Middleware\ResponseCaching.Abstractions\src\Microsoft.AspNetCore.ResponseCaching.Abstractions.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.ResponseCaching" ProjectPath="$(RepositoryRoot)src\Middleware\ResponseCaching\src\Microsoft.AspNetCore.ResponseCaching.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.ResponseCompression" ProjectPath="$(RepositoryRoot)src\Middleware\ResponseCompression\src\Microsoft.AspNetCore.ResponseCompression.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Rewrite" ProjectPath="$(RepositoryRoot)src\Middleware\Rewrite\src\Microsoft.AspNetCore.Rewrite.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Session" ProjectPath="$(RepositoryRoot)src\Middleware\Session\src\Microsoft.AspNetCore.Session.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.SpaServices.Extensions" ProjectPath="$(RepositoryRoot)src\Middleware\SpaServices.Extensions\src\Microsoft.AspNetCore.SpaServices.Extensions.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.SpaServices" ProjectPath="$(RepositoryRoot)src\Middleware\SpaServices\src\Microsoft.AspNetCore.SpaServices.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.StaticFiles" ProjectPath="$(RepositoryRoot)src\Middleware\StaticFiles\src\Microsoft.AspNetCore.StaticFiles.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.WebSockets" ProjectPath="$(RepositoryRoot)src\Middleware\WebSockets\src\Microsoft.AspNetCore.WebSockets.csproj" />
|
||||
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Razor.Runtime" ProjectPath="$(RepositoryRoot)src\Razor\Razor.Runtime\src\Microsoft.AspNetCore.Razor.Runtime.csproj" />
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81",
|
||||
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||
"Microsoft.VisualStudio.Component.VC.ATL",
|
||||
"Microsoft.VisualStudio.Component.Windows10SDK.15063.Desktop"
|
||||
"Microsoft.VisualStudio.Component.Windows10SDK.17134"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 2f81b98c133c24ec699f370bf07b557dd484c646
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<!-- General properties -->
|
||||
|
||||
<PropertyGroup>
|
||||
<IisOobWinSdkVersion Condition="'$(IisOobWinSdkVersion)' == ''">10.0.15063.0</IisOobWinSdkVersion>
|
||||
<IisOobWinSdkVersion Condition="'$(IisOobWinSdkVersion)' == ''">10.0.17134.0</IisOobWinSdkVersion>
|
||||
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(IisOobWinSdkVersion)</WindowsTargetPlatformVersion>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<OutDir>bin\$(Configuration)\$(PlatformShortname)\</OutDir>
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
[Oo]bj/
|
||||
[Bb]in/
|
||||
TestResults/
|
||||
.nuget/
|
||||
*.sln.ide/
|
||||
_ReSharper.*/
|
||||
packages/
|
||||
artifacts/
|
||||
PublishProfiles/
|
||||
*.user
|
||||
*.suo
|
||||
*.cache
|
||||
*.docstates
|
||||
_ReSharper.*
|
||||
nuget.exe
|
||||
*net45.csproj
|
||||
*net451.csproj
|
||||
*k10.csproj
|
||||
*.psess
|
||||
*.vsp
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*DS_Store
|
||||
*.ncrunchsolution
|
||||
*.*sdf
|
||||
*.ipch
|
||||
.vs/
|
||||
npm-debug.log
|
||||
/.build/
|
||||
.vscode/
|
||||
global.json
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<Project>
|
||||
<Import Project="version.props" />
|
||||
<Import Project="build\dependencies.props" />
|
||||
<Import Project="build\sources.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Product>Microsoft ASP.NET Core</Product>
|
||||
<RepositoryUrl>https://github.com/aspnet/AspNetCore</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
|
||||
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\..\eng\AspNetCore.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Artifacts layout -->
|
||||
<PropertyGroup>
|
||||
<ArtifactsDir>$(MSBuildThisFileDirectory)..\..\artifacts\</ArtifactsDir>
|
||||
<ArtifactsConfigurationDir>$(ArtifactsDir)$(Configuration)\</ArtifactsConfigurationDir>
|
||||
<BasePackageOutputPath>$(ArtifactsConfigurationDir)packages\</BasePackageOutputPath>
|
||||
<ProductPackageOutputPath>$(BasePackageOutputPath)product\</ProductPackageOutputPath>
|
||||
<InternalPackageOutputPath>$(BasePackageOutputPath)internal\</InternalPackageOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!--
|
||||
By default, all projects which produce packages are not intended to ship to NuGet.org as a product package.
|
||||
Packages which are intended to ship to NuGet.org must opt-in by setting this to true in the project file.
|
||||
-->
|
||||
<IsProductPackage Condition=" '$(IsProductPackage)' == '' ">false</IsProductPackage>
|
||||
|
||||
<PackageOutputPath Condition=" '$(IsProductPackage)' == 'true' ">$(ProductPackageOutputPath)</PackageOutputPath>
|
||||
<PackageOutputPath Condition=" '$(IsProductPackage)' != 'true' ">$(InternalPackageOutputPath)</PackageOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26730.16
|
||||
MinimumVisualStudioVersion = 15.0.26730.03
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{27304DDE-AFB2-4F8B-B765-E3E2F11E886C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\Directory.Build.props = src\Directory.Build.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.NodeServices", "src\Microsoft.AspNetCore.NodeServices\Microsoft.AspNetCore.NodeServices.csproj", "{66B77203-1469-41DF-92F2-2BE6900BD36F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.NodeServices.Sockets", "src\Microsoft.AspNetCore.NodeServices.Sockets\Microsoft.AspNetCore.NodeServices.Sockets.csproj", "{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SpaServices", "src\Microsoft.AspNetCore.SpaServices\Microsoft.AspNetCore.SpaServices.csproj", "{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{99EAF1FE-22C8-4526-BE78-74B24125D37F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitignore = .gitignore
|
||||
global.json = global.json
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{23836492-E7F4-4376-85BF-A635C304AC46}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{E6A161EA-646C-4033-9090-95BE809AB8D9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LatencyTest", "samples\misc\LatencyTest\LatencyTest.csproj", "{1931B19A-EC42-4D56-B2D0-FB06D17244DA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Webpack", "samples\misc\Webpack\Webpack.csproj", "{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NodeServicesExamples", "samples\misc\NodeServicesExamples\NodeServicesExamples.csproj", "{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{645F7363-1240-4FB6-9422-B32A327C979F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Directory.Build.props = Directory.Build.props
|
||||
Directory.Build.targets = Directory.Build.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SpaServices.Extensions", "src\Microsoft.AspNetCore.SpaServices.Extensions\Microsoft.AspNetCore.SpaServices.Extensions.csproj", "{D40BD1C4-6A6F-4213-8535-1057F3EB3400}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{66B77203-1469-41DF-92F2-2BE6900BD36F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{66B77203-1469-41DF-92F2-2BE6900BD36F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{66B77203-1469-41DF-92F2-2BE6900BD36F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{66B77203-1469-41DF-92F2-2BE6900BD36F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{66B77203-1469-41DF-92F2-2BE6900BD36F} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||
{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||
{E6A161EA-646C-4033-9090-95BE809AB8D9} = {23836492-E7F4-4376-85BF-A635C304AC46}
|
||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA} = {E6A161EA-646C-4033-9090-95BE809AB8D9}
|
||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344} = {E6A161EA-646C-4033-9090-95BE809AB8D9}
|
||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE} = {E6A161EA-646C-4033-9090-95BE809AB8D9}
|
||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DDF59B0D-2DEC-45D6-8667-DCB767487101}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"Default": {
|
||||
"rules": [
|
||||
"DefaultCompositeRule"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
# JavaScriptServices
|
||||
|
||||
## What is this?
|
||||
|
||||
`JavaScriptServices` is a set of client-side technologies for ASP.NET Core. It provides infrastructure that you'll find useful if you:
|
||||
|
||||
- Use Angular / React / Vue / Aurelia / Knockout / etc.
|
||||
- Build your client-side resources using Webpack.
|
||||
- Execute JavaScript on the server at runtime.
|
||||
|
||||
Read [Building Single Page Applications on ASP.NET Core with JavaScriptServices](https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/) for more details.
|
||||
|
||||
This repo contains:
|
||||
|
||||
* A set of NuGet/NPM packages that implement functionality for:
|
||||
* Invoking arbitrary NPM packages at runtime from .NET code ([docs](/src/JavaScriptServices/src/Microsoft.AspNetCore.NodeServices#simple-usage-example))
|
||||
* Server-side prerendering of SPA components ([docs](/src/JavaScriptServices/src/Microsoft.AspNetCore.SpaServices#server-side-prerendering))
|
||||
* Webpack dev middleware ([docs](/src/JavaScriptServices/src/Microsoft.AspNetCore.SpaServices#webpack-dev-middleware))
|
||||
* Hot module replacement (HMR) ([docs](/src/JavaScriptServices/src/Microsoft.AspNetCore.SpaServices#webpack-hot-module-replacement))
|
||||
* Server-side and client-side routing integration ([docs](/src/JavaScriptServices/src/Microsoft.AspNetCore.SpaServices#routing-helper-mapspafallbackroute))
|
||||
* Server-side and client-side validation integration
|
||||
* "Lazy loading" for Knockout apps
|
||||
* Samples and docs
|
||||
|
||||
It's cross-platform (Windows, Linux, or macOS) and works with .NET Core 2.0 or later.
|
||||
|
||||
## Creating new applications
|
||||
|
||||
Prerequisites:
|
||||
|
||||
* [.NET Core 2.0](https://www.microsoft.com/net/core) (or later) SDK
|
||||
* [Node.js](https://nodejs.org/) version 6 (or later)
|
||||
|
||||
With these prerequisites, you can immediately create new ASP.NET Core applications that use Angular, React, or React+Redux without having to install anything extra.
|
||||
|
||||
### Option 1: Creating Angular/React/Redux applications from the command line (cross-platform)
|
||||
|
||||
In an empty directory, run (for example) `dotnet new angular`. Other supported SPA frameworks include React and React+Redux. You can see the list of available SPA templates by running `dotnet new spa`.
|
||||
|
||||
Once the generator has run and restored all the dependencies, you can start up your new ASP.NET Core SPA:
|
||||
|
||||
npm install
|
||||
dotnet run
|
||||
|
||||
### Option 2: Creating Angular/React/Redux applications using Visual Studio 2017 Update 3 or later (Windows only)
|
||||
|
||||
Using the `File`->`New Project` dialog, select *ASP.NET Core Web Application*. You will then be offered the option to create an application with Angular, React, or React+Redux. When the application is created, you can build and run it in the normal way.
|
||||
|
||||
### More info and other SPA frameworks
|
||||
|
||||
For a more detailed (albeit somewhat outdated) walkthrough, see [getting started with the `aspnetcore-spa` generator](http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/).
|
||||
|
||||
If you want to build an ASP.NET Core application with Aurelia, Knockout, or Vue, you can use the `Microsoft.AspNetCore.SpaTemplates` package. On the command line, run `dotnet new --install Microsoft.AspNetCore.SpaTemplates`. Then you will be able to run `dotnet new aurelia` (or `dotnet new vue`, etc.) to create your new application.
|
||||
|
||||
## Adding to existing applications
|
||||
|
||||
If you have an existing ASP.NET Core application, or if you just want to use the underlying JavaScriptServices packages directly, you can install these packages using NuGet and NPM:
|
||||
|
||||
* `Microsoft.AspNetCore.NodeServices`
|
||||
* This provides a fast and robust way for .NET code to run JavaScript on the server inside a Node.js environment. You can use this to consume arbitrary functionality from NPM packages at runtime in your ASP.NET Core app.
|
||||
* Most applications developers don't need to use this directly, but you can do so if you want to implement your own functionality that involves calling Node.js code from .NET at runtime.
|
||||
* Find [documentation and usage examples here](/src/JavaScriptServices/src/Microsoft.AspNetCore.NodeServices#microsoftaspnetcorenodeservices).
|
||||
* `Microsoft.AspNetCore.SpaServices`
|
||||
* This provides infrastructure that's generally useful when building Single Page Applications (SPAs) with technologies such as Angular or React (for example, server-side prerendering and webpack middleware). Internally, it uses the `NodeServices` package to implement its features.
|
||||
* Find [documentation and usage examples here](/src/JavaScriptServices/src/Microsoft.AspNetCore.SpaServices#microsoftaspnetcorespaservices)
|
||||
|
||||
There were previously other packages called `Microsoft.AspNetCore.AngularServices` and `Microsoft.AspNetCore.ReactServices` but these are not currently needed - all applicable functionality is in `Microsoft.AspNetCore.SpaServices`, because it's sufficiently general.
|
||||
|
||||
If you want to build a helper library for some other SPA framework, you can do so by taking a dependency on `Microsoft.AspNetCore.SpaServices` and wrapping its functionality in whatever way is most useful for your SPA framework.
|
||||
|
||||
## Samples
|
||||
|
||||
The [`samples` directory](/src/JavaScriptServices/samples) contains examples of:
|
||||
|
||||
- Using the JavaScript services family of packages with Angular and React.
|
||||
- A standalone `NodeServices` usage for runtime code transpilation and image processing.
|
||||
|
||||
**To run the samples:**
|
||||
|
||||
* Clone this repo
|
||||
* At the repo's root directory (the one containing `src`, `samples`, etc.), run `dotnet restore`
|
||||
* Change directory to the sample you want to run (for example, `cd samples/angular/MusicStore`)
|
||||
* Restore Node dependencies by running `npm install`
|
||||
* If you're trying to run the Angular "Music Store" sample, then also run `gulp` (which you need to have installed globally). None of the other samples require this.
|
||||
* Run the application (`dotnet run`)
|
||||
* Browse to [http://localhost:5000](http://localhost:5000)
|
||||
|
||||
## Contributing
|
||||
|
||||
If you're interested in contributing to the various packages, samples, and project templates in this repo, that's great!
|
||||
|
||||
Before working on a pull request, especially if it's more than a trivial fix (for example, for a typo), it's usually a good idea first to file an issue describing what you're proposing to do and how it will work. Then you can find out if it's likely that such a pull request will be accepted, and how it fits into wider ongoing plans.
|
||||
Binary file not shown.
|
|
@ -1,30 +0,0 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Package Versions">
|
||||
<InternalAspNetCoreSdkPackageVersion>3.0.0-build-20181114.5</InternalAspNetCoreSdkPackageVersion>
|
||||
<MicrosoftAspNetCoreDiagnosticsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreDiagnosticsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingPackageVersion>
|
||||
<MicrosoftAspNetCoreMvcPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcPackageVersion>
|
||||
<MicrosoftAspNetCoreMvcTagHelpersPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcTagHelpersPackageVersion>
|
||||
<MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>
|
||||
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||
<MicrosoftAspNetCoreServerKestrelPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||
<MicrosoftAspNetCoreStaticFilesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
||||
<MicrosoftAspNetCoreWebSocketsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreWebSocketsPackageVersion>
|
||||
<MicrosoftExtensionsDependencyInjectionPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
||||
<MicrosoftExtensionsFileProvidersPhysicalPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsFileProvidersPhysicalPackageVersion>
|
||||
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsLoggingConsolePackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||
<MicrosoftExtensionsLoggingDebugPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingDebugPackageVersion>
|
||||
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreAppPackageVersion>
|
||||
<MicrosoftNETSdkRazorPackageVersion>3.0.0-preview-18579-0056</MicrosoftNETSdkRazorPackageVersion>
|
||||
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
||||
<NewtonsoftJsonPackageVersion>12.0.1</NewtonsoftJsonPackageVersion>
|
||||
<SystemThreadingTasksDataflowPackageVersion>4.10.0-preview1-26907-04</SystemThreadingTasksDataflowPackageVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||
<PropertyGroup Label="Package Versions: Pinned" />
|
||||
</Project>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<Project>
|
||||
<Import Project="dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OverridePackageOutputPath>false</OverridePackageOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCoreRuntime Include="$(MicrosoftNETCoreAppPackageVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<Project>
|
||||
<Import Project="$(DotNetRestoreSourcePropsPath)" Condition="'$(DotNetRestoreSourcePropsPath)' != ''"/>
|
||||
|
||||
<PropertyGroup Label="RestoreSources">
|
||||
<RestoreSources>$(DotNetRestoreSources)</RestoreSources>
|
||||
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true' AND '$(AspNetUniverseBuildOffline)' != 'true' ">
|
||||
$(RestoreSources);
|
||||
https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
|
||||
https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json;
|
||||
https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json;
|
||||
</RestoreSources>
|
||||
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'">
|
||||
$(RestoreSources);
|
||||
https://api.nuget.org/v3/index.json;
|
||||
</RestoreSources>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<OutputType>exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.NodeServices\Microsoft.AspNetCore.NodeServices.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.NodeServices.Sockets\Microsoft.AspNetCore.NodeServices.Sockets.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.NodeServices;
|
||||
using Microsoft.AspNetCore.NodeServices.Sockets;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ConsoleApplication
|
||||
{
|
||||
// This project is a micro-benchmark for .NET->Node RPC via NodeServices. It doesn't reflect
|
||||
// real-world usage patterns (you're not likely to make hundreds of sequential calls like this),
|
||||
// but is a starting point for comparing the overhead of different hosting models and transports.
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args) {
|
||||
// Set up the DI system
|
||||
var services = new ServiceCollection();
|
||||
services.AddNodeServices(options => {
|
||||
// To compare with Socket hosting, uncomment the following line
|
||||
// Since .NET Core 1.1, the HTTP hosting model has become basically as fast as the Socket hosting model
|
||||
//options.UseSocketHosting();
|
||||
|
||||
options.WatchFileExtensions = new string[] {}; // Don't watch anything
|
||||
});
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
// Now instantiate an INodeServices and use it
|
||||
using (var nodeServices = serviceProvider.GetRequiredService<INodeServices>()) {
|
||||
MeasureLatency(nodeServices).Wait();
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task MeasureLatency(INodeServices nodeServices) {
|
||||
// Ensure the connection is open, so we can measure per-request timings below
|
||||
var response = await nodeServices.InvokeAsync<string>("latencyTest", "C#");
|
||||
Console.WriteLine(response);
|
||||
|
||||
// Now perform a series of requests, capturing the time taken
|
||||
const int requestCount = 100;
|
||||
var watch = Stopwatch.StartNew();
|
||||
for (var i = 0; i < requestCount; i++) {
|
||||
await nodeServices.InvokeAsync<string>("latencyTest", "C#");
|
||||
}
|
||||
|
||||
// Display results
|
||||
var elapsedSeconds = (float)watch.ElapsedTicks / Stopwatch.Frequency;
|
||||
Console.WriteLine("\nTotal time: {0:F2} milliseconds", 1000 * elapsedSeconds);
|
||||
Console.WriteLine("\nTime per invocation: {0:F2} milliseconds", 1000 * elapsedSeconds / requestCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
module.exports = function(callback, incomingParam1) {
|
||||
var result = 'Hello, ' + incomingParam1 + '!';
|
||||
callback(/* error */ null, result);
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.SpaServices\Microsoft.AspNetCore.SpaServices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(MicrosoftAspNetCoreDiagnosticsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
||||
<Exec Command="npm install" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.SpaServices\Microsoft.AspNetCore.SpaServices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(MicrosoftAspNetCoreDiagnosticsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
||||
<Exec Command="npm install" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
[cmdletbinding(SupportsShouldProcess = $true)]
|
||||
param(
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Set-StrictMode -Version 2
|
||||
|
||||
Push-Location "src"
|
||||
try {
|
||||
$dirs = Get-ChildItem -Directory
|
||||
foreach($dir in $dirs)
|
||||
{
|
||||
Push-Location $dir
|
||||
try{
|
||||
if(Test-Path -Path "package.json")
|
||||
{
|
||||
npm install
|
||||
npm run build
|
||||
}
|
||||
}
|
||||
finally{
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<Project>
|
||||
<Import Project="..\Directory.Build.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;aspnetcoremvc;nodeservices</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,626 +0,0 @@
|
|||
(function (e, a) { for (var i in a) e[i] = a[i]; }(exports, /******/(function (modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if (installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/
|
||||
}
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/
|
||||
}
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function (exports, name, getter) {
|
||||
/******/ if (!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/
|
||||
}
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function (exports) {
|
||||
/******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/
|
||||
}
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function (value, mode) {
|
||||
/******/ if (mode & 1) value = __webpack_require__(value);
|
||||
/******/ if (mode & 8) return value;
|
||||
/******/ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if (mode & 2 && typeof value != 'string') for (var key in value) __webpack_require__.d(ns, key, function (key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function (module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/
|
||||
};
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/
|
||||
})
|
||||
/************************************************************************/
|
||||
/******/([
|
||||
/* 0 */
|
||||
/***/ (function (module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(1);
|
||||
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 1 */
|
||||
/***/ (function (module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
// Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
|
||||
// but simplifies things for the consumer of this module.
|
||||
__webpack_require__(2);
|
||||
var net = __webpack_require__(3);
|
||||
var path = __webpack_require__(4);
|
||||
var readline = __webpack_require__(5);
|
||||
var ArgsUtil_1 = __webpack_require__(6);
|
||||
var ExitWhenParentExits_1 = __webpack_require__(7);
|
||||
var virtualConnectionServer = __webpack_require__(8);
|
||||
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
||||
// reference to Node's runtime 'require' function.
|
||||
var dynamicRequire = eval('require');
|
||||
// Signal to the .NET side when we're ready to accept invocations
|
||||
var server = net.createServer().on('listening', function () {
|
||||
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
||||
});
|
||||
// Each virtual connection represents a separate invocation
|
||||
virtualConnectionServer.createInterface(server).on('connection', function (connection) {
|
||||
readline.createInterface(connection, null).on('line', function (line) {
|
||||
try {
|
||||
// Get a reference to the function to invoke
|
||||
var invocation = JSON.parse(line);
|
||||
var invokedModule = dynamicRequire(path.resolve(process.cwd(), invocation.moduleName));
|
||||
var invokedFunction = invocation.exportedFunctionName ? invokedModule[invocation.exportedFunctionName] : invokedModule;
|
||||
// Prepare a callback for accepting non-streamed JSON responses
|
||||
var hasInvokedCallback_1 = false;
|
||||
var invocationCallback = function (errorValue, successValue) {
|
||||
if (hasInvokedCallback_1) {
|
||||
throw new Error('Cannot supply more than one result. The callback has already been invoked,'
|
||||
+ ' or the result stream has already been accessed');
|
||||
}
|
||||
hasInvokedCallback_1 = true;
|
||||
connection.end(JSON.stringify({
|
||||
result: successValue,
|
||||
errorMessage: errorValue && (errorValue.message || errorValue),
|
||||
errorDetails: errorValue && (errorValue.stack || null)
|
||||
}));
|
||||
};
|
||||
// Also support streamed binary responses
|
||||
Object.defineProperty(invocationCallback, 'stream', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
hasInvokedCallback_1 = true;
|
||||
return connection;
|
||||
}
|
||||
});
|
||||
// Actually invoke it, passing through any supplied args
|
||||
invokedFunction.apply(null, [invocationCallback].concat(invocation.args));
|
||||
}
|
||||
catch (ex) {
|
||||
connection.end(JSON.stringify({
|
||||
errorMessage: ex.message,
|
||||
errorDetails: ex.stack
|
||||
}));
|
||||
}
|
||||
});
|
||||
});
|
||||
// Begin listening now. The underlying transport varies according to the runtime platform.
|
||||
// On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets.
|
||||
var useWindowsNamedPipes = /^win/.test(process.platform);
|
||||
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
|
||||
var listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress;
|
||||
server.listen(listenAddress);
|
||||
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
|
||||
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 2 */
|
||||
/***/ (function (module, exports) {
|
||||
|
||||
// When Node writes to stdout/strerr, we capture that and convert the lines into calls on the
|
||||
// active .NET ILogger. But by default, stdout/stderr don't have any way of distinguishing
|
||||
// linebreaks inside log messages from the linebreaks that delimit separate log messages,
|
||||
// so multiline strings will end up being written to the ILogger as multiple independent
|
||||
// log messages. This makes them very hard to make sense of, especially when they represent
|
||||
// something like stack traces.
|
||||
//
|
||||
// To fix this, we intercept stdout/stderr writes, and replace internal linebreaks with a
|
||||
// marker token. When .NET receives the lines, it converts the marker tokens back to regular
|
||||
// linebreaks within the logged messages.
|
||||
//
|
||||
// Note that it's better to do the interception at the stdout/stderr level, rather than at
|
||||
// the console.log/console.error (etc.) level, because this takes place after any native
|
||||
// message formatting has taken place (e.g., inserting values for % placeholders).
|
||||
var findInternalNewlinesRegex = /\n(?!$)/g;
|
||||
var encodedNewline = '__ns_newline__';
|
||||
encodeNewlinesWrittenToStream(process.stdout);
|
||||
encodeNewlinesWrittenToStream(process.stderr);
|
||||
function encodeNewlinesWrittenToStream(outputStream) {
|
||||
var origWriteFunction = outputStream.write;
|
||||
outputStream.write = function (value) {
|
||||
// Only interfere with the write if it's definitely a string
|
||||
if (typeof value === 'string') {
|
||||
var argsClone = Array.prototype.slice.call(arguments, 0);
|
||||
argsClone[0] = encodeNewlinesInString(value);
|
||||
origWriteFunction.apply(this, argsClone);
|
||||
}
|
||||
else {
|
||||
origWriteFunction.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
function encodeNewlinesInString(str) {
|
||||
return str.replace(findInternalNewlinesRegex, encodedNewline);
|
||||
}
|
||||
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 3 */
|
||||
/***/ (function (module, exports) {
|
||||
|
||||
module.exports = require("net");
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 4 */
|
||||
/***/ (function (module, exports) {
|
||||
|
||||
module.exports = require("path");
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 5 */
|
||||
/***/ (function (module, exports) {
|
||||
|
||||
module.exports = require("readline");
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 6 */
|
||||
/***/ (function (module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
function parseArgs(args) {
|
||||
// Very simplistic parsing which is sufficient for the cases needed. We don't want to bring in any external
|
||||
// dependencies (such as an args-parsing library) to this file.
|
||||
var result = {};
|
||||
var currentKey = null;
|
||||
args.forEach(function (arg) {
|
||||
if (arg.indexOf('--') === 0) {
|
||||
var argName = arg.substring(2);
|
||||
result[argName] = undefined;
|
||||
currentKey = argName;
|
||||
}
|
||||
else if (currentKey) {
|
||||
result[currentKey] = arg;
|
||||
currentKey = null;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
exports.parseArgs = parseArgs;
|
||||
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 7 */
|
||||
/***/ (function (module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
In general, we want the Node child processes to be terminated as soon as the parent .NET processes exit,
|
||||
because we have no further use for them. If the .NET process shuts down gracefully, it will run its
|
||||
finalizers, one of which (in OutOfProcessNodeInstance.cs) will kill its associated Node process immediately.
|
||||
|
||||
But if the .NET process is terminated forcefully (e.g., on Linux/OSX with 'kill -9'), then it won't have
|
||||
any opportunity to shut down its child processes, and by default they will keep running. In this case, it's
|
||||
up to the child process to detect this has happened and terminate itself.
|
||||
|
||||
There are many possible approaches to detecting when a parent process has exited, most of which behave
|
||||
differently between Windows and Linux/OS X:
|
||||
|
||||
- On Windows, the parent process can mark its child as being a 'job' that should auto-terminate when
|
||||
the parent does (http://stackoverflow.com/a/4657392). Not cross-platform.
|
||||
- The child Node process can get a callback when the parent disconnects (process.on('disconnect', ...)).
|
||||
But despite http://stackoverflow.com/a/16487966, no callback fires in any case I've tested (Windows / OS X).
|
||||
- The child Node process can get a callback when its stdin/stdout are disconnected, as described at
|
||||
http://stackoverflow.com/a/15693934. This works well on OS X, but calling stdout.resume() on Windows
|
||||
causes the process to terminate prematurely.
|
||||
- I don't know why, but on Windows, it's enough to invoke process.stdin.resume(). For some reason this causes
|
||||
the child Node process to exit as soon as the parent one does, but I don't see this documented anywhere.
|
||||
- You can poll to see if the parent process, or your stdin/stdout connection to it, is gone
|
||||
- You can directly pass a parent process PID to the child, and then have the child poll to see if it's
|
||||
still running (e.g., using process.kill(pid, 0), which doesn't kill it but just tests whether it exists,
|
||||
as per https://nodejs.org/api/process.html#process_process_kill_pid_signal)
|
||||
- Or, on each poll, you can try writing to process.stdout. If the parent has died, then this will throw.
|
||||
However I don't see this documented anywhere. It would be nice if you could just poll for whether or not
|
||||
process.stdout is still connected (without actually writing to it) but I haven't found any property whose
|
||||
value changes until you actually try to write to it.
|
||||
|
||||
Of these, the only cross-platform approach that is actually documented as a valid strategy is simply polling
|
||||
to check whether the parent PID is still running. So that's what we do here.
|
||||
*/
|
||||
exports.__esModule = true;
|
||||
var pollIntervalMs = 1000;
|
||||
function exitWhenParentExits(parentPid, ignoreSigint) {
|
||||
setInterval(function () {
|
||||
if (!processExists(parentPid)) {
|
||||
// Can't log anything at this point, because out stdout was connected to the parent,
|
||||
// but the parent is gone.
|
||||
process.exit();
|
||||
}
|
||||
}, pollIntervalMs);
|
||||
if (ignoreSigint) {
|
||||
// Pressing ctrl+c in the terminal sends a SIGINT to all processes in the foreground process tree.
|
||||
// By default, the Node process would then exit before the .NET process, because ASP.NET implements
|
||||
// a delayed shutdown to allow ongoing requests to complete.
|
||||
//
|
||||
// This is problematic, because if Node exits first, the CopyToAsync code in ConditionalProxyMiddleware
|
||||
// will experience a read fault, and logs a huge load of errors. Fortunately, since the Node process is
|
||||
// already set up to shut itself down if it detects the .NET process is terminated, all we have to do is
|
||||
// ignore the SIGINT. The Node process will then terminate automatically after the .NET process does.
|
||||
//
|
||||
// A better solution would be to have WebpackDevMiddleware listen for SIGINT and gracefully close any
|
||||
// ongoing EventSource connections before letting the Node process exit, independently of the .NET
|
||||
// process exiting. However, doing this well in general is very nontrivial (see all the discussion at
|
||||
// https://github.com/nodejs/node/issues/2642).
|
||||
process.on('SIGINT', function () {
|
||||
console.log('Received SIGINT. Waiting for .NET process to exit...');
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.exitWhenParentExits = exitWhenParentExits;
|
||||
function processExists(pid) {
|
||||
try {
|
||||
// Sending signal 0 - on all platforms - tests whether the process exists. As long as it doesn't
|
||||
// throw, that means it does exist.
|
||||
process.kill(pid, 0);
|
||||
return true;
|
||||
}
|
||||
catch (ex) {
|
||||
// If the reason for the error is that we don't have permission to ask about this process,
|
||||
// report that as a separate problem.
|
||||
if (ex.code === 'EPERM') {
|
||||
throw new Error("Attempted to check whether process " + pid + " was running, but got a permissions error.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 8 */
|
||||
/***/ (function (module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
var events_1 = __webpack_require__(9);
|
||||
var VirtualConnection_1 = __webpack_require__(10);
|
||||
// Keep this in sync with the equivalent constant in the .NET code. Both sides split up their transmissions into frames with this max length,
|
||||
// and both will reject longer frames.
|
||||
var MaxFrameBodyLength = 16 * 1024;
|
||||
/**
|
||||
* Accepts connections to a net.Server and adapts them to behave as multiplexed connections. That is, for each physical socket connection,
|
||||
* we track a list of 'virtual connections' whose API is a Duplex stream. The remote clients may open and close as many virtual connections
|
||||
* as they wish, reading and writing to them independently, without the overhead of establishing new physical connections each time.
|
||||
*/
|
||||
function createInterface(server) {
|
||||
var emitter = new events_1.EventEmitter();
|
||||
server.on('connection', function (socket) {
|
||||
// For each physical socket connection, maintain a set of virtual connections. Issue a notification whenever
|
||||
// a new virtual connections is opened.
|
||||
var childSockets = new VirtualConnectionsCollection(socket, function (virtualConnection) {
|
||||
emitter.emit('connection', virtualConnection);
|
||||
});
|
||||
});
|
||||
return emitter;
|
||||
}
|
||||
exports.createInterface = createInterface;
|
||||
/**
|
||||
* Tracks the 'virtual connections' associated with a single physical socket connection.
|
||||
*/
|
||||
var VirtualConnectionsCollection = /** @class */ (function () {
|
||||
function VirtualConnectionsCollection(_socket, _onVirtualConnectionCallback) {
|
||||
var _this = this;
|
||||
this._socket = _socket;
|
||||
this._onVirtualConnectionCallback = _onVirtualConnectionCallback;
|
||||
this._currentFrameHeader = null;
|
||||
this._virtualConnections = {};
|
||||
// If the remote end closes the physical socket, treat all the virtual connections as being closed remotely too
|
||||
this._socket.on('close', function () {
|
||||
Object.getOwnPropertyNames(_this._virtualConnections).forEach(function (id) {
|
||||
// A 'null' frame signals that the connection was closed remotely
|
||||
_this._virtualConnections[id].onReceivedData(null);
|
||||
});
|
||||
});
|
||||
this._socket.on('readable', this._onIncomingDataAvailable.bind(this));
|
||||
}
|
||||
/**
|
||||
* This is called whenever the underlying socket signals that it may have some data available to read. It will synchronously read as many
|
||||
* message frames as it can from the underlying socket, opens virtual connections as needed, and dispatches data to them.
|
||||
*/
|
||||
VirtualConnectionsCollection.prototype._onIncomingDataAvailable = function () {
|
||||
var exhaustedAllData = false;
|
||||
while (!exhaustedAllData) {
|
||||
// We might already have a pending frame header from the previous time this method ran, but if not, that's the next thing we need to read
|
||||
if (this._currentFrameHeader === null) {
|
||||
this._currentFrameHeader = this._readNextFrameHeader();
|
||||
}
|
||||
if (this._currentFrameHeader === null) {
|
||||
// There's not enough data to fill a frameheader, so wait until more arrives later
|
||||
// The next attempt to read from the socket will start from the same place this one did (incomplete reads don't consume any data)
|
||||
exhaustedAllData = true;
|
||||
}
|
||||
else {
|
||||
var frameBodyLength = this._currentFrameHeader.bodyLength;
|
||||
var frameBodyOrNull = frameBodyLength > 0 ? this._socket.read(this._currentFrameHeader.bodyLength) : null;
|
||||
if (frameBodyOrNull !== null || frameBodyLength === 0) {
|
||||
// We have a complete frame header+body pair, so we can now dispatch this to a virtual connection. We set _currentFrameHeader back to null
|
||||
// so that the next thing we try to read is the next frame header.
|
||||
var headerCopy = this._currentFrameHeader;
|
||||
this._currentFrameHeader = null;
|
||||
this._onReceivedCompleteFrame(headerCopy, frameBodyOrNull);
|
||||
}
|
||||
else {
|
||||
// There's not enough data to fill the pending frame body, so wait until more arrives later
|
||||
// The next attempt to read from the socket will start from the same place this one did (incomplete reads don't consume any data)
|
||||
exhaustedAllData = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
VirtualConnectionsCollection.prototype._onReceivedCompleteFrame = function (header, bodyIfNotEmpty) {
|
||||
// An incoming zero-length frame signals that there's no more data to read.
|
||||
// Signal this to the Node stream APIs by pushing a 'null' chunk to it.
|
||||
var virtualConnection = this._getOrOpenVirtualConnection(header);
|
||||
virtualConnection.onReceivedData(header.bodyLength > 0 ? bodyIfNotEmpty : null);
|
||||
};
|
||||
VirtualConnectionsCollection.prototype._getOrOpenVirtualConnection = function (header) {
|
||||
if (this._virtualConnections.hasOwnProperty(header.connectionIdString)) {
|
||||
// It's an existing virtual connection
|
||||
return this._virtualConnections[header.connectionIdString];
|
||||
}
|
||||
else {
|
||||
// It's a new one
|
||||
return this._openVirtualConnection(header);
|
||||
}
|
||||
};
|
||||
VirtualConnectionsCollection.prototype._openVirtualConnection = function (header) {
|
||||
var _this = this;
|
||||
var beginWriteCallback = function (data, writeCompletedCallback) {
|
||||
// Only send nonempty frames, since empty ones are a signal to close the virtual connection
|
||||
if (data.length > 0) {
|
||||
_this._sendFrame(header.connectionIdBinary, data, writeCompletedCallback);
|
||||
}
|
||||
};
|
||||
var newVirtualConnection = new VirtualConnection_1.VirtualConnection(beginWriteCallback);
|
||||
newVirtualConnection.on('end', function () {
|
||||
// The virtual connection was closed remotely. Clean up locally.
|
||||
_this._onVirtualConnectionWasClosed(header.connectionIdString);
|
||||
});
|
||||
newVirtualConnection.on('finish', function () {
|
||||
// The virtual connection was closed locally. Clean up locally, and notify the remote that we're done.
|
||||
_this._onVirtualConnectionWasClosed(header.connectionIdString);
|
||||
_this._sendFrame(header.connectionIdBinary, Buffer.alloc(0));
|
||||
});
|
||||
this._virtualConnections[header.connectionIdString] = newVirtualConnection;
|
||||
this._onVirtualConnectionCallback(newVirtualConnection);
|
||||
return newVirtualConnection;
|
||||
};
|
||||
/**
|
||||
* Attempts to read a complete frame header, synchronously, from the underlying socket.
|
||||
* If not enough data is available synchronously, returns null without consuming any data from the socket.
|
||||
*/
|
||||
VirtualConnectionsCollection.prototype._readNextFrameHeader = function () {
|
||||
var headerBuf = this._socket.read(12);
|
||||
if (headerBuf !== null) {
|
||||
// We have enough data synchronously
|
||||
var connectionIdBinary = headerBuf.slice(0, 8);
|
||||
var connectionIdString = connectionIdBinary.toString('hex');
|
||||
var bodyLength = headerBuf.readInt32LE(8);
|
||||
if (bodyLength < 0 || bodyLength > MaxFrameBodyLength) {
|
||||
// Throwing here is going to bring down the whole process, so this cannot be allowed to happen in real use.
|
||||
// But it won't happen in real use, because this is only used with our .NET client, which doesn't violate this rule.
|
||||
throw new Error('Illegal frame body length: ' + bodyLength);
|
||||
}
|
||||
return { connectionIdBinary: connectionIdBinary, connectionIdString: connectionIdString, bodyLength: bodyLength };
|
||||
}
|
||||
else {
|
||||
// Not enough bytes are available synchronously, so none were consumed
|
||||
return null;
|
||||
}
|
||||
};
|
||||
VirtualConnectionsCollection.prototype._sendFrame = function (connectionIdBinary, data, callback) {
|
||||
// For all sends other than the last one, only invoke the callback if it failed.
|
||||
// Also, only invoke the callback at most once.
|
||||
var hasInvokedCallback = false;
|
||||
var finalCallback = callback && (function (error) {
|
||||
if (!hasInvokedCallback) {
|
||||
hasInvokedCallback = true;
|
||||
callback(error);
|
||||
}
|
||||
});
|
||||
var notFinalCallback = callback && (function (error) {
|
||||
if (error) {
|
||||
finalCallback(error);
|
||||
}
|
||||
});
|
||||
// The amount of data we're writing might exceed MaxFrameBodyLength, so split into frames as needed.
|
||||
// Note that we always send at least one frame, even if it's empty (because that's the close-virtual-connection signal).
|
||||
// If needed, this could be changed to send frames asynchronously, so that large sends could proceed in parallel
|
||||
// (though that would involve making a clone of 'data', to avoid the risk of it being mutated during the send).
|
||||
var bytesSent = 0;
|
||||
do {
|
||||
var nextFrameBodyLength = Math.min(MaxFrameBodyLength, data.length - bytesSent);
|
||||
var isFinalChunk = (bytesSent + nextFrameBodyLength) === data.length;
|
||||
this._socket.write(connectionIdBinary, notFinalCallback);
|
||||
this._sendInt32LE(nextFrameBodyLength, notFinalCallback);
|
||||
this._socket.write(data.slice(bytesSent, bytesSent + nextFrameBodyLength), isFinalChunk ? finalCallback : notFinalCallback);
|
||||
bytesSent += nextFrameBodyLength;
|
||||
} while (bytesSent < data.length);
|
||||
};
|
||||
/**
|
||||
* Sends a number serialized in the correct format for .NET to receive as a System.Int32
|
||||
*/
|
||||
VirtualConnectionsCollection.prototype._sendInt32LE = function (value, callback) {
|
||||
var buf = Buffer.alloc(4);
|
||||
buf.writeInt32LE(value, 0);
|
||||
this._socket.write(buf, callback);
|
||||
};
|
||||
VirtualConnectionsCollection.prototype._onVirtualConnectionWasClosed = function (id) {
|
||||
if (this._virtualConnections.hasOwnProperty(id)) {
|
||||
delete this._virtualConnections[id];
|
||||
}
|
||||
};
|
||||
return VirtualConnectionsCollection;
|
||||
}());
|
||||
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 9 */
|
||||
/***/ (function (module, exports) {
|
||||
|
||||
module.exports = require("events");
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 10 */
|
||||
/***/ (function (module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var stream_1 = __webpack_require__(11);
|
||||
/**
|
||||
* Represents a virtual connection. Multiple virtual connections may be multiplexed over a single physical socket connection.
|
||||
*/
|
||||
var VirtualConnection = /** @class */ (function (_super) {
|
||||
__extends(VirtualConnection, _super);
|
||||
function VirtualConnection(_beginWriteCallback) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this._beginWriteCallback = _beginWriteCallback;
|
||||
_this._flowing = false;
|
||||
_this._receivedDataQueue = [];
|
||||
return _this;
|
||||
}
|
||||
VirtualConnection.prototype._read = function () {
|
||||
this._flowing = true;
|
||||
// Keep pushing data until we run out, or the underlying framework asks us to stop.
|
||||
// When we finish, the 'flowing' state is detemined by whether more data is still being requested.
|
||||
while (this._flowing && this._receivedDataQueue.length > 0) {
|
||||
var nextChunk = this._receivedDataQueue.shift();
|
||||
this._flowing = this.push(nextChunk);
|
||||
}
|
||||
};
|
||||
VirtualConnection.prototype._write = function (chunk, encodingIfString, callback) {
|
||||
if (typeof chunk === 'string') {
|
||||
chunk = Buffer.from(chunk, encodingIfString);
|
||||
}
|
||||
this._beginWriteCallback(chunk, callback);
|
||||
};
|
||||
VirtualConnection.prototype.onReceivedData = function (dataOrNullToSignalEOF) {
|
||||
if (this._flowing) {
|
||||
this._flowing = this.push(dataOrNullToSignalEOF);
|
||||
}
|
||||
else {
|
||||
this._receivedDataQueue.push(dataOrNullToSignalEOF);
|
||||
}
|
||||
};
|
||||
return VirtualConnection;
|
||||
}(stream_1.Duplex));
|
||||
exports.VirtualConnection = VirtualConnection;
|
||||
|
||||
|
||||
/***/
|
||||
}),
|
||||
/* 11 */
|
||||
/***/ (function (module, exports) {
|
||||
|
||||
module.exports = require("stream");
|
||||
|
||||
/***/
|
||||
})
|
||||
/******/])));
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>Socket-based RPC for Microsoft.AspNetCore.NodeServices.</Description>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="node_modules\**\*" />
|
||||
<EmbeddedResource Include="Content\**\*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.AspNetCore.NodeServices\Microsoft.AspNetCore.NodeServices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="$(SystemThreadingTasksDataflowPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
|
||||
<Exec Command="npm install" />
|
||||
<Exec Command="node node_modules/webpack/bin/webpack.js" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
using System.IO;
|
||||
using System.IO.Pipes;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
|
||||
{
|
||||
internal class NamedPipeConnection : StreamConnection
|
||||
{
|
||||
private bool _disposedValue = false;
|
||||
private NamedPipeClientStream _namedPipeClientStream;
|
||||
|
||||
#pragma warning disable 1998 // Because in the NET451 code path, there's nothing to await
|
||||
public override async Task<Stream> Open(string address)
|
||||
{
|
||||
_namedPipeClientStream = new NamedPipeClientStream(
|
||||
".",
|
||||
address,
|
||||
PipeDirection.InOut,
|
||||
PipeOptions.Asynchronous);
|
||||
|
||||
await _namedPipeClientStream.ConnectAsync().ConfigureAwait(false);
|
||||
|
||||
return _namedPipeClientStream;
|
||||
}
|
||||
#pragma warning restore 1998
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
if (!_disposedValue)
|
||||
{
|
||||
if (_namedPipeClientStream != null)
|
||||
{
|
||||
_namedPipeClientStream.Dispose();
|
||||
}
|
||||
|
||||
_disposedValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
|
||||
{
|
||||
internal abstract class StreamConnection : IDisposable
|
||||
{
|
||||
public abstract Task<Stream> Open(string address);
|
||||
public abstract void Dispose();
|
||||
|
||||
public static StreamConnection Create()
|
||||
{
|
||||
var useNamedPipes = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(
|
||||
System.Runtime.InteropServices.OSPlatform.Windows);
|
||||
if (useNamedPipes)
|
||||
{
|
||||
return new NamedPipeConnection();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new UnixDomainSocketConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
|
||||
{
|
||||
internal class UnixDomainSocketConnection : StreamConnection
|
||||
{
|
||||
private bool _disposedValue = false;
|
||||
private NetworkStream _networkStream;
|
||||
private Socket _socket;
|
||||
|
||||
public override async Task<Stream> Open(string address)
|
||||
{
|
||||
var endPoint = new UnixDomainSocketEndPoint("/tmp/" + address);
|
||||
_socket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Unspecified);
|
||||
await _socket.ConnectAsync(endPoint).ConfigureAwait(false);
|
||||
_networkStream = new NetworkStream(_socket);
|
||||
return _networkStream;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
if (!_disposedValue)
|
||||
{
|
||||
if (_networkStream != null)
|
||||
{
|
||||
_networkStream.Dispose();
|
||||
}
|
||||
|
||||
if (_socket != null)
|
||||
{
|
||||
_socket.Dispose();
|
||||
}
|
||||
|
||||
_disposedValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
|
||||
{
|
||||
// From System.IO.Pipes/src/System/Net/Sockets/UnixDomainSocketEndPoint.cs (an internal class in System.IO.Pipes)
|
||||
internal sealed class UnixDomainSocketEndPoint : EndPoint
|
||||
{
|
||||
private const AddressFamily EndPointAddressFamily = AddressFamily.Unix;
|
||||
|
||||
private static readonly Encoding s_pathEncoding = Encoding.UTF8;
|
||||
private static readonly int s_nativePathOffset = 2; // = offsetof(struct sockaddr_un, sun_path). It's the same on Linux and OSX
|
||||
private static readonly int s_nativePathLength = 91; // sockaddr_un.sun_path at http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_un.h.html, -1 for terminator
|
||||
private static readonly int s_nativeAddressSize = s_nativePathOffset + s_nativePathLength;
|
||||
|
||||
private readonly string _path;
|
||||
private readonly byte[] _encodedPath;
|
||||
|
||||
public UnixDomainSocketEndPoint(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
_path = path;
|
||||
_encodedPath = s_pathEncoding.GetBytes(_path);
|
||||
|
||||
if (path.Length == 0 || _encodedPath.Length > s_nativePathLength)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(path));
|
||||
}
|
||||
}
|
||||
|
||||
internal UnixDomainSocketEndPoint(SocketAddress socketAddress)
|
||||
{
|
||||
if (socketAddress == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(socketAddress));
|
||||
}
|
||||
|
||||
if (socketAddress.Family != EndPointAddressFamily ||
|
||||
socketAddress.Size > s_nativeAddressSize)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(socketAddress));
|
||||
}
|
||||
|
||||
if (socketAddress.Size > s_nativePathOffset)
|
||||
{
|
||||
_encodedPath = new byte[socketAddress.Size - s_nativePathOffset];
|
||||
for (int i = 0; i < _encodedPath.Length; i++)
|
||||
{
|
||||
_encodedPath[i] = socketAddress[s_nativePathOffset + i];
|
||||
}
|
||||
|
||||
_path = s_pathEncoding.GetString(_encodedPath, 0, _encodedPath.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
_encodedPath = Array.Empty<byte>();
|
||||
_path = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public override SocketAddress Serialize()
|
||||
{
|
||||
var result = new SocketAddress(AddressFamily.Unix, s_nativeAddressSize);
|
||||
|
||||
for (int index = 0; index < _encodedPath.Length; index++)
|
||||
{
|
||||
result[s_nativePathOffset + index] = _encodedPath[index];
|
||||
}
|
||||
result[s_nativePathOffset + _encodedPath.Length] = 0; // path must be null-terminated
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override EndPoint Create(SocketAddress socketAddress) => new UnixDomainSocketEndPoint(socketAddress);
|
||||
|
||||
public override AddressFamily AddressFamily => EndPointAddressFamily;
|
||||
|
||||
public override string ToString() => _path;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,240 +0,0 @@
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.NodeServices.HostingModels;
|
||||
using Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections;
|
||||
using Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets
|
||||
{
|
||||
/// <summary>
|
||||
/// A specialisation of the OutOfProcessNodeInstance base class that uses a lightweight binary streaming protocol
|
||||
/// to perform RPC invocations. The physical transport is Named Pipes on Windows, or Domain Sockets on Linux/Mac.
|
||||
/// For details on the binary streaming protocol, see <see cref="Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections.VirtualConnectionClient" />
|
||||
/// The advantage versus using HTTP for RPC is that this is faster (not surprisingly - there's much less overhead
|
||||
/// because we don't need most of the functionality of HTTP.
|
||||
///
|
||||
/// The address of the pipe/socket is selected randomly here on the .NET side and sent to the child process as a
|
||||
/// command-line argument (the address space is wide enough that there's no real risk of a clash, unlike when
|
||||
/// selecting TCP port numbers).
|
||||
/// </summary>
|
||||
/// <seealso cref="Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance" />
|
||||
internal class SocketNodeInstance : OutOfProcessNodeInstance
|
||||
{
|
||||
private readonly static JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
TypeNameHandling = TypeNameHandling.None
|
||||
};
|
||||
|
||||
private readonly static int streamBufferSize = 16 * 1024;
|
||||
private readonly static UTF8Encoding utf8EncodingWithoutBom = new UTF8Encoding(false);
|
||||
|
||||
private readonly SemaphoreSlim _connectionCreationSemaphore = new SemaphoreSlim(1);
|
||||
private bool _connectionHasFailed;
|
||||
private StreamConnection _physicalConnection;
|
||||
private string _socketAddress;
|
||||
private VirtualConnectionClient _virtualConnectionClient;
|
||||
|
||||
public SocketNodeInstance(NodeServicesOptions options, string socketAddress)
|
||||
: base(
|
||||
EmbeddedResourceReader.Read(
|
||||
typeof(SocketNodeInstance),
|
||||
"/Content/Node/entrypoint-socket.js"),
|
||||
options.ProjectPath,
|
||||
options.WatchFileExtensions,
|
||||
MakeNewCommandLineOptions(socketAddress),
|
||||
options.ApplicationStoppingToken,
|
||||
options.NodeInstanceOutputLogger,
|
||||
options.EnvironmentVariables,
|
||||
options.InvocationTimeoutMilliseconds,
|
||||
options.LaunchWithDebugging,
|
||||
options.DebuggingPort)
|
||||
{
|
||||
_socketAddress = socketAddress;
|
||||
}
|
||||
|
||||
protected override async Task<T> InvokeExportAsync<T>(NodeInvocationInfo invocationInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_connectionHasFailed)
|
||||
{
|
||||
// _connectionHasFailed implies a protocol-level error. The old instance is no longer of any use.
|
||||
var allowConnectionDraining = false;
|
||||
|
||||
// This special exception type forces NodeServicesImpl to restart the Node instance
|
||||
throw new NodeInvocationException(
|
||||
"The SocketNodeInstance socket connection failed. See logs to identify the reason.",
|
||||
details: null,
|
||||
nodeInstanceUnavailable: true,
|
||||
allowConnectionDraining: allowConnectionDraining);
|
||||
}
|
||||
|
||||
if (_virtualConnectionClient == null)
|
||||
{
|
||||
// Although we could pass the cancellationToken into EnsureVirtualConnectionClientCreated and
|
||||
// have it signal cancellations upstream, that would be a bad thing to do, because all callers
|
||||
// wait for the same connection task. There's no reason why the first caller should have the
|
||||
// special ability to cancel the connection process in a way that would affect subsequent
|
||||
// callers. So, each caller just independently stops awaiting connection if that call is cancelled.
|
||||
await ThrowOnCancellation(EnsureVirtualConnectionClientCreated(), cancellationToken);
|
||||
}
|
||||
|
||||
// For each invocation, we open a new virtual connection. This gives an API equivalent to opening a new
|
||||
// physical connection to the child process, but without the overhead of doing so, because it's really
|
||||
// just multiplexed into the existing physical connection stream.
|
||||
bool shouldDisposeVirtualConnection = true;
|
||||
Stream virtualConnection = null;
|
||||
try
|
||||
{
|
||||
virtualConnection = _virtualConnectionClient.OpenVirtualConnection();
|
||||
|
||||
// Send request
|
||||
WriteJsonLine(virtualConnection, invocationInfo);
|
||||
|
||||
// Determine what kind of response format is expected
|
||||
if (typeof(T) == typeof(Stream))
|
||||
{
|
||||
// Pass through streamed binary response
|
||||
// It is up to the consumer to dispose this stream, so don't do so here
|
||||
shouldDisposeVirtualConnection = false;
|
||||
return (T)(object)virtualConnection;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse and return non-streamed JSON response
|
||||
var response = await ReadJsonAsync<RpcJsonResponse<T>>(virtualConnection, cancellationToken);
|
||||
if (response.ErrorMessage != null)
|
||||
{
|
||||
throw new NodeInvocationException(response.ErrorMessage, response.ErrorDetails);
|
||||
}
|
||||
|
||||
return response.Result;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (shouldDisposeVirtualConnection)
|
||||
{
|
||||
virtualConnection.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task EnsureVirtualConnectionClientCreated()
|
||||
{
|
||||
// Asynchronous equivalent to a 'lock(...) { ... }'
|
||||
await _connectionCreationSemaphore.WaitAsync();
|
||||
try
|
||||
{
|
||||
if (_virtualConnectionClient == null)
|
||||
{
|
||||
_physicalConnection = StreamConnection.Create();
|
||||
|
||||
var connection = await _physicalConnection.Open(_socketAddress);
|
||||
_virtualConnectionClient = new VirtualConnectionClient(connection);
|
||||
_virtualConnectionClient.OnError += (ex) =>
|
||||
{
|
||||
// This callback is fired only if there's a protocol-level failure (e.g., child process disconnected
|
||||
// unexpectedly). It does *not* fire when RPC calls return errors. Since there's been a protocol-level
|
||||
// failure, this Node instance is no longer usable and should be discarded.
|
||||
_connectionHasFailed = true;
|
||||
|
||||
OutputLogger.LogError(0, ex, ex.Message);
|
||||
};
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_connectionCreationSemaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_virtualConnectionClient != null)
|
||||
{
|
||||
_virtualConnectionClient.Dispose();
|
||||
_virtualConnectionClient = null;
|
||||
}
|
||||
|
||||
if (_physicalConnection != null)
|
||||
{
|
||||
_physicalConnection.Dispose();
|
||||
_physicalConnection = null;
|
||||
}
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private static void WriteJsonLine(Stream stream, object serializableObject)
|
||||
{
|
||||
using (var streamWriter = new StreamWriter(stream, utf8EncodingWithoutBom, streamBufferSize, true))
|
||||
using (var jsonWriter = new JsonTextWriter(streamWriter))
|
||||
{
|
||||
jsonWriter.CloseOutput = false;
|
||||
jsonWriter.AutoCompleteOnClose = false;
|
||||
|
||||
var serializer = JsonSerializer.Create(jsonSerializerSettings);
|
||||
serializer.Serialize(jsonWriter, serializableObject);
|
||||
jsonWriter.Flush();
|
||||
|
||||
streamWriter.WriteLine();
|
||||
streamWriter.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<T> ReadJsonAsync<T>(Stream stream, CancellationToken cancellationToken)
|
||||
{
|
||||
var json = Encoding.UTF8.GetString(await ReadAllBytesAsync(stream, cancellationToken));
|
||||
return JsonConvert.DeserializeObject<T>(json, jsonSerializerSettings);
|
||||
}
|
||||
|
||||
private static async Task<byte[]> ReadAllBytesAsync(Stream input, CancellationToken cancellationToken)
|
||||
{
|
||||
byte[] buffer = new byte[streamBufferSize];
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
int read;
|
||||
while ((read = await input.ReadAsync(buffer, 0, buffer.Length, cancellationToken)) > 0)
|
||||
{
|
||||
ms.Write(buffer, 0, read);
|
||||
}
|
||||
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private static string MakeNewCommandLineOptions(string listenAddress)
|
||||
{
|
||||
return $"--listenAddress {listenAddress}";
|
||||
}
|
||||
|
||||
private static Task ThrowOnCancellation(Task task, CancellationToken cancellationToken)
|
||||
{
|
||||
return task.IsCompleted
|
||||
? task // If the task is already completed, no need to wrap it in a further layer of task
|
||||
: task.ContinueWith(
|
||||
_ => {}, // If the task completes, allow execution to continue
|
||||
cancellationToken,
|
||||
TaskContinuationOptions.ExecuteSynchronously,
|
||||
TaskScheduler.Default);
|
||||
}
|
||||
|
||||
#pragma warning disable 649 // These properties are populated via JSON deserialization
|
||||
private class RpcJsonResponse<TResult>
|
||||
{
|
||||
public TResult Result { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
public string ErrorDetails { get; set; }
|
||||
}
|
||||
#pragma warning restore 649
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods that help with populating a <see cref="NodeServicesOptions"/> object.
|
||||
/// </summary>
|
||||
public static class NodeServicesOptionsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures the <see cref="INodeServices"/> service so that it will use out-of-process
|
||||
/// Node.js instances and perform RPC calls over binary sockets (on Windows, this is
|
||||
/// implemented as named pipes; on other platforms it uses domain sockets).
|
||||
/// </summary>
|
||||
public static void UseSocketHosting(this NodeServicesOptions options)
|
||||
{
|
||||
var pipeName = "pni-" + Guid.NewGuid().ToString("D"); // Arbitrary non-clashing string
|
||||
options.NodeInstanceFactory = () => new SocketNodeInstance(options, pipeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
// Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
|
||||
// but simplifies things for the consumer of this module.
|
||||
import '../../Microsoft.AspNetCore.NodeServices/TypeScript/Util/OverrideStdOutputs';
|
||||
import * as net from 'net';
|
||||
import * as path from 'path';
|
||||
import * as readline from 'readline';
|
||||
import { Duplex } from 'stream';
|
||||
import { parseArgs } from '../../Microsoft.AspNetCore.NodeServices/TypeScript/Util/ArgsUtil';
|
||||
import { exitWhenParentExits } from '../../Microsoft.AspNetCore.NodeServices/TypeScript/Util/ExitWhenParentExits';
|
||||
import * as virtualConnectionServer from './VirtualConnections/VirtualConnectionServer';
|
||||
|
||||
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
||||
// reference to Node's runtime 'require' function.
|
||||
const dynamicRequire: (name: string) => any = eval('require');
|
||||
|
||||
// Signal to the .NET side when we're ready to accept invocations
|
||||
const server = net.createServer().on('listening', () => {
|
||||
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
||||
});
|
||||
|
||||
// Each virtual connection represents a separate invocation
|
||||
virtualConnectionServer.createInterface(server).on('connection', (connection: Duplex) => {
|
||||
readline.createInterface(connection, null).on('line', line => {
|
||||
try {
|
||||
// Get a reference to the function to invoke
|
||||
const invocation = JSON.parse(line) as RpcInvocation;
|
||||
const invokedModule = dynamicRequire(path.resolve(process.cwd(), invocation.moduleName));
|
||||
const invokedFunction = invocation.exportedFunctionName ? invokedModule[invocation.exportedFunctionName] : invokedModule;
|
||||
|
||||
// Prepare a callback for accepting non-streamed JSON responses
|
||||
let hasInvokedCallback = false;
|
||||
const invocationCallback = (errorValue, successValue) => {
|
||||
if (hasInvokedCallback) {
|
||||
throw new Error('Cannot supply more than one result. The callback has already been invoked,'
|
||||
+ ' or the result stream has already been accessed');
|
||||
}
|
||||
|
||||
hasInvokedCallback = true;
|
||||
connection.end(JSON.stringify({
|
||||
result: successValue,
|
||||
errorMessage: errorValue && (errorValue.message || errorValue),
|
||||
errorDetails: errorValue && (errorValue.stack || null)
|
||||
}));
|
||||
};
|
||||
|
||||
// Also support streamed binary responses
|
||||
Object.defineProperty(invocationCallback, 'stream', {
|
||||
enumerable: true,
|
||||
get: (): Duplex => {
|
||||
hasInvokedCallback = true;
|
||||
return connection;
|
||||
}
|
||||
});
|
||||
|
||||
// Actually invoke it, passing through any supplied args
|
||||
invokedFunction.apply(null, [invocationCallback].concat(invocation.args));
|
||||
} catch (ex) {
|
||||
connection.end(JSON.stringify({
|
||||
errorMessage: ex.message,
|
||||
errorDetails: ex.stack
|
||||
}));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Begin listening now. The underlying transport varies according to the runtime platform.
|
||||
// On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets.
|
||||
const useWindowsNamedPipes = /^win/.test(process.platform);
|
||||
const parsedArgs = parseArgs(process.argv);
|
||||
const listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress;
|
||||
server.listen(listenAddress);
|
||||
|
||||
exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
|
||||
|
||||
interface RpcInvocation {
|
||||
moduleName: string;
|
||||
exportedFunctionName: string;
|
||||
args: any[];
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
import { Duplex } from 'stream';
|
||||
|
||||
export type EndWriteCallback = (error?: any) => void;
|
||||
export type BeginWriteCallback = (data: Buffer, callback: EndWriteCallback) => void;
|
||||
|
||||
/**
|
||||
* Represents a virtual connection. Multiple virtual connections may be multiplexed over a single physical socket connection.
|
||||
*/
|
||||
export class VirtualConnection extends Duplex {
|
||||
private _flowing = false;
|
||||
private _receivedDataQueue: Buffer[] = [];
|
||||
|
||||
constructor(private _beginWriteCallback: BeginWriteCallback) {
|
||||
super();
|
||||
}
|
||||
|
||||
public _read() {
|
||||
this._flowing = true;
|
||||
|
||||
// Keep pushing data until we run out, or the underlying framework asks us to stop.
|
||||
// When we finish, the 'flowing' state is detemined by whether more data is still being requested.
|
||||
while (this._flowing && this._receivedDataQueue.length > 0) {
|
||||
const nextChunk = this._receivedDataQueue.shift();
|
||||
this._flowing = this.push(nextChunk);
|
||||
}
|
||||
}
|
||||
|
||||
public _write(chunk: Buffer | string, encodingIfString: string, callback: EndWriteCallback) {
|
||||
if (typeof chunk === 'string') {
|
||||
chunk = Buffer.from(chunk as string, encodingIfString);
|
||||
}
|
||||
|
||||
this._beginWriteCallback(chunk as Buffer, callback);
|
||||
}
|
||||
|
||||
public onReceivedData(dataOrNullToSignalEOF: Buffer) {
|
||||
if (this._flowing) {
|
||||
this._flowing = this.push(dataOrNullToSignalEOF);
|
||||
} else {
|
||||
this._receivedDataQueue.push(dataOrNullToSignalEOF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
import { Server, Socket } from 'net';
|
||||
import { EventEmitter } from 'events';
|
||||
import { Duplex } from 'stream';
|
||||
import { VirtualConnection, EndWriteCallback } from './VirtualConnection';
|
||||
|
||||
// Keep this in sync with the equivalent constant in the .NET code. Both sides split up their transmissions into frames with this max length,
|
||||
// and both will reject longer frames.
|
||||
const MaxFrameBodyLength = 16 * 1024;
|
||||
|
||||
/**
|
||||
* Accepts connections to a net.Server and adapts them to behave as multiplexed connections. That is, for each physical socket connection,
|
||||
* we track a list of 'virtual connections' whose API is a Duplex stream. The remote clients may open and close as many virtual connections
|
||||
* as they wish, reading and writing to them independently, without the overhead of establishing new physical connections each time.
|
||||
*/
|
||||
export function createInterface(server: Server): EventEmitter {
|
||||
const emitter = new EventEmitter();
|
||||
|
||||
server.on('connection', (socket: Socket) => {
|
||||
// For each physical socket connection, maintain a set of virtual connections. Issue a notification whenever
|
||||
// a new virtual connections is opened.
|
||||
const childSockets = new VirtualConnectionsCollection(socket, virtualConnection => {
|
||||
emitter.emit('connection', virtualConnection);
|
||||
});
|
||||
});
|
||||
|
||||
return emitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks the 'virtual connections' associated with a single physical socket connection.
|
||||
*/
|
||||
class VirtualConnectionsCollection {
|
||||
private _currentFrameHeader: FrameHeader = null;
|
||||
private _virtualConnections: { [id: string]: VirtualConnection } = {};
|
||||
|
||||
constructor(private _socket: Socket, private _onVirtualConnectionCallback: (virtualConnection: Duplex) => void) {
|
||||
// If the remote end closes the physical socket, treat all the virtual connections as being closed remotely too
|
||||
this._socket.on('close', () => {
|
||||
Object.getOwnPropertyNames(this._virtualConnections).forEach(id => {
|
||||
// A 'null' frame signals that the connection was closed remotely
|
||||
this._virtualConnections[id].onReceivedData(null);
|
||||
});
|
||||
});
|
||||
|
||||
this._socket.on('readable', this._onIncomingDataAvailable.bind(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called whenever the underlying socket signals that it may have some data available to read. It will synchronously read as many
|
||||
* message frames as it can from the underlying socket, opens virtual connections as needed, and dispatches data to them.
|
||||
*/
|
||||
private _onIncomingDataAvailable() {
|
||||
let exhaustedAllData = false;
|
||||
|
||||
while (!exhaustedAllData) {
|
||||
// We might already have a pending frame header from the previous time this method ran, but if not, that's the next thing we need to read
|
||||
if (this._currentFrameHeader === null) {
|
||||
this._currentFrameHeader = this._readNextFrameHeader();
|
||||
}
|
||||
|
||||
if (this._currentFrameHeader === null) {
|
||||
// There's not enough data to fill a frameheader, so wait until more arrives later
|
||||
// The next attempt to read from the socket will start from the same place this one did (incomplete reads don't consume any data)
|
||||
exhaustedAllData = true;
|
||||
} else {
|
||||
const frameBodyLength = this._currentFrameHeader.bodyLength;
|
||||
const frameBodyOrNull: Buffer = frameBodyLength > 0 ? this._socket.read(this._currentFrameHeader.bodyLength) : null;
|
||||
if (frameBodyOrNull !== null || frameBodyLength === 0) {
|
||||
// We have a complete frame header+body pair, so we can now dispatch this to a virtual connection. We set _currentFrameHeader back to null
|
||||
// so that the next thing we try to read is the next frame header.
|
||||
const headerCopy = this._currentFrameHeader;
|
||||
this._currentFrameHeader = null;
|
||||
this._onReceivedCompleteFrame(headerCopy, frameBodyOrNull);
|
||||
} else {
|
||||
// There's not enough data to fill the pending frame body, so wait until more arrives later
|
||||
// The next attempt to read from the socket will start from the same place this one did (incomplete reads don't consume any data)
|
||||
exhaustedAllData = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _onReceivedCompleteFrame(header: FrameHeader, bodyIfNotEmpty: Buffer) {
|
||||
// An incoming zero-length frame signals that there's no more data to read.
|
||||
// Signal this to the Node stream APIs by pushing a 'null' chunk to it.
|
||||
const virtualConnection = this._getOrOpenVirtualConnection(header);
|
||||
virtualConnection.onReceivedData(header.bodyLength > 0 ? bodyIfNotEmpty : null);
|
||||
}
|
||||
|
||||
private _getOrOpenVirtualConnection(header: FrameHeader) {
|
||||
if (this._virtualConnections.hasOwnProperty(header.connectionIdString)) {
|
||||
// It's an existing virtual connection
|
||||
return this._virtualConnections[header.connectionIdString];
|
||||
} else {
|
||||
// It's a new one
|
||||
return this._openVirtualConnection(header);
|
||||
}
|
||||
}
|
||||
|
||||
private _openVirtualConnection(header: FrameHeader) {
|
||||
const beginWriteCallback = (data, writeCompletedCallback) => {
|
||||
// Only send nonempty frames, since empty ones are a signal to close the virtual connection
|
||||
if (data.length > 0) {
|
||||
this._sendFrame(header.connectionIdBinary, data, writeCompletedCallback);
|
||||
}
|
||||
};
|
||||
|
||||
const newVirtualConnection = new VirtualConnection(beginWriteCallback);
|
||||
newVirtualConnection.on('end', () => {
|
||||
// The virtual connection was closed remotely. Clean up locally.
|
||||
this._onVirtualConnectionWasClosed(header.connectionIdString);
|
||||
});
|
||||
newVirtualConnection.on('finish', () => {
|
||||
// The virtual connection was closed locally. Clean up locally, and notify the remote that we're done.
|
||||
this._onVirtualConnectionWasClosed(header.connectionIdString);
|
||||
this._sendFrame(header.connectionIdBinary, Buffer.alloc(0));
|
||||
});
|
||||
|
||||
this._virtualConnections[header.connectionIdString] = newVirtualConnection;
|
||||
this._onVirtualConnectionCallback(newVirtualConnection);
|
||||
return newVirtualConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to read a complete frame header, synchronously, from the underlying socket.
|
||||
* If not enough data is available synchronously, returns null without consuming any data from the socket.
|
||||
*/
|
||||
private _readNextFrameHeader(): FrameHeader {
|
||||
const headerBuf: Buffer = this._socket.read(12);
|
||||
if (headerBuf !== null) {
|
||||
// We have enough data synchronously
|
||||
const connectionIdBinary = headerBuf.slice(0, 8);
|
||||
const connectionIdString = connectionIdBinary.toString('hex');
|
||||
const bodyLength = headerBuf.readInt32LE(8);
|
||||
if (bodyLength < 0 || bodyLength > MaxFrameBodyLength) {
|
||||
// Throwing here is going to bring down the whole process, so this cannot be allowed to happen in real use.
|
||||
// But it won't happen in real use, because this is only used with our .NET client, which doesn't violate this rule.
|
||||
throw new Error('Illegal frame body length: ' + bodyLength);
|
||||
}
|
||||
|
||||
return { connectionIdBinary, connectionIdString, bodyLength };
|
||||
} else {
|
||||
// Not enough bytes are available synchronously, so none were consumed
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private _sendFrame(connectionIdBinary: Buffer, data: Buffer, callback?: EndWriteCallback) {
|
||||
// For all sends other than the last one, only invoke the callback if it failed.
|
||||
// Also, only invoke the callback at most once.
|
||||
let hasInvokedCallback = false;
|
||||
const finalCallback: EndWriteCallback = callback && (error => {
|
||||
if (!hasInvokedCallback) {
|
||||
hasInvokedCallback = true;
|
||||
callback(error);
|
||||
}
|
||||
});
|
||||
const notFinalCallback: EndWriteCallback = callback && (error => {
|
||||
if (error) {
|
||||
finalCallback(error);
|
||||
}
|
||||
});
|
||||
|
||||
// The amount of data we're writing might exceed MaxFrameBodyLength, so split into frames as needed.
|
||||
// Note that we always send at least one frame, even if it's empty (because that's the close-virtual-connection signal).
|
||||
// If needed, this could be changed to send frames asynchronously, so that large sends could proceed in parallel
|
||||
// (though that would involve making a clone of 'data', to avoid the risk of it being mutated during the send).
|
||||
let bytesSent = 0;
|
||||
do {
|
||||
const nextFrameBodyLength = Math.min(MaxFrameBodyLength, data.length - bytesSent);
|
||||
const isFinalChunk = (bytesSent + nextFrameBodyLength) === data.length;
|
||||
this._socket.write(connectionIdBinary, notFinalCallback);
|
||||
this._sendInt32LE(nextFrameBodyLength, notFinalCallback);
|
||||
this._socket.write(data.slice(bytesSent, bytesSent + nextFrameBodyLength), isFinalChunk ? finalCallback : notFinalCallback);
|
||||
bytesSent += nextFrameBodyLength;
|
||||
} while (bytesSent < data.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a number serialized in the correct format for .NET to receive as a System.Int32
|
||||
*/
|
||||
private _sendInt32LE(value: number, callback?: EndWriteCallback) {
|
||||
const buf = Buffer.alloc(4);
|
||||
buf.writeInt32LE(value, 0);
|
||||
this._socket.write(buf, callback);
|
||||
}
|
||||
|
||||
private _onVirtualConnectionWasClosed(id: string) {
|
||||
if (this._virtualConnections.hasOwnProperty(id)) {
|
||||
delete this._virtualConnections[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface FrameHeader {
|
||||
connectionIdBinary: Buffer;
|
||||
connectionIdString: string;
|
||||
bodyLength: number;
|
||||
}
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks.Dataflow;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections
|
||||
{
|
||||
/// <summary>
|
||||
/// A virtual read/write connection, typically to a remote process. Multiple virtual connections can be
|
||||
/// multiplexed over a single physical connection (e.g., a named pipe, domain socket, or TCP socket).
|
||||
/// </summary>
|
||||
internal class VirtualConnection : Stream
|
||||
{
|
||||
private readonly static Task CompletedTask = Task.CompletedTask;
|
||||
private VirtualConnectionClient _host;
|
||||
private readonly BufferBlock<byte[]> _receivedDataQueue = new BufferBlock<byte[]>();
|
||||
private ArraySegment<byte> _receivedDataNotYetUsed;
|
||||
private bool _wasClosedByRemote;
|
||||
private bool _isDisposed;
|
||||
|
||||
public VirtualConnection(long id, VirtualConnectionClient host)
|
||||
{
|
||||
Id = id;
|
||||
_host = host;
|
||||
}
|
||||
|
||||
public long Id { get; }
|
||||
|
||||
public override bool CanRead { get { return true; } }
|
||||
public override bool CanSeek { get { return false; } }
|
||||
public override bool CanWrite { get { return true; } }
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
// We're auto-flushing, so this is a no-op.
|
||||
}
|
||||
|
||||
public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_wasClosedByRemote)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var bytesRead = 0;
|
||||
while (true)
|
||||
{
|
||||
// Pull as many applicable bytes as we can out of receivedDataNotYetUsed, then update its offset/length
|
||||
int bytesToExtract = Math.Min(count - bytesRead, _receivedDataNotYetUsed.Count);
|
||||
if (bytesToExtract > 0)
|
||||
{
|
||||
Buffer.BlockCopy(_receivedDataNotYetUsed.Array, _receivedDataNotYetUsed.Offset, buffer, bytesRead, bytesToExtract);
|
||||
_receivedDataNotYetUsed = new ArraySegment<byte>(_receivedDataNotYetUsed.Array, _receivedDataNotYetUsed.Offset + bytesToExtract, _receivedDataNotYetUsed.Count - bytesToExtract);
|
||||
bytesRead += bytesToExtract;
|
||||
}
|
||||
|
||||
// If we've completely filled the output buffer, we're done
|
||||
if (bytesRead == count)
|
||||
{
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
// We haven't yet filled the output buffer, so we must have exhausted receivedDataNotYetUsed instead.
|
||||
// We want to get the next block of data from the underlying queue.
|
||||
byte[] nextReceivedBlock;
|
||||
if (bytesRead > 0)
|
||||
{
|
||||
if (!_receivedDataQueue.TryReceive(null, out nextReceivedBlock))
|
||||
{
|
||||
// No more data is available synchronously, and we already have some data, so we can stop now
|
||||
return bytesRead;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Since we don't yet have anything, wait for the underlying source
|
||||
nextReceivedBlock = await _receivedDataQueue.ReceiveAsync(cancellationToken);
|
||||
}
|
||||
|
||||
if (nextReceivedBlock.Length == 0)
|
||||
{
|
||||
// A zero-length block signals that the remote regards this virtual connection as closed
|
||||
_wasClosedByRemote = true;
|
||||
return bytesRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We got some more data, so can continue trying to fill the output buffer
|
||||
_receivedDataNotYetUsed = new ArraySegment<byte>(nextReceivedBlock, 0, nextReceivedBlock.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_wasClosedByRemote)
|
||||
{
|
||||
throw new InvalidOperationException("The connection was already closed by the remote party");
|
||||
}
|
||||
|
||||
return count > 0 ? _host.WriteAsync(Id, buffer, offset, count, cancellationToken) : CompletedTask;
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
return ReadAsync(buffer, offset, count, CancellationToken.None).Result;
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
WriteAsync(buffer, offset, count, CancellationToken.None).Wait();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && !_isDisposed)
|
||||
{
|
||||
_isDisposed = true;
|
||||
_host.CloseInnerStream(Id, _wasClosedByRemote);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task AddDataToQueue(byte[] data)
|
||||
{
|
||||
await _receivedDataQueue.SendAsync(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections
|
||||
{
|
||||
/// <summary>
|
||||
/// A callback that will be invoked if the <see cref="VirtualConnectionClient"/> encounters a read error.
|
||||
/// </summary>
|
||||
/// <param name="ex"></param>
|
||||
public delegate void VirtualConnectionReadErrorHandler(Exception ex);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps an underlying physical read/write stream (e.g., named pipes, domain sockets, or TCP sockets) and
|
||||
/// exposes an API for making 'virtual connections', which act as independent read/write streams.
|
||||
/// Traffic over these virtual connections is multiplexed over the underlying physical stream. This is useful
|
||||
/// for fast stream-based inter-process communication because it avoids the overhead of opening a new physical
|
||||
/// connection each time a new communication channel is needed.
|
||||
/// </summary>
|
||||
internal class VirtualConnectionClient : IDisposable
|
||||
{
|
||||
internal const int MaxFrameBodyLength = 16 * 1024;
|
||||
|
||||
public event VirtualConnectionReadErrorHandler OnError;
|
||||
|
||||
private Stream _underlyingTransport;
|
||||
private Dictionary<long, VirtualConnection> _activeInnerStreams;
|
||||
private long _nextInnerStreamId;
|
||||
private readonly SemaphoreSlim _streamWriterSemaphore = new SemaphoreSlim(1);
|
||||
private readonly object _readControlLock = new object();
|
||||
private Exception _readLoopExitedWithException;
|
||||
private readonly CancellationTokenSource _disposalCancellatonToken = new CancellationTokenSource();
|
||||
private bool _disposedValue = false;
|
||||
|
||||
public VirtualConnectionClient(Stream underlyingTransport)
|
||||
{
|
||||
_underlyingTransport = underlyingTransport;
|
||||
_activeInnerStreams = new Dictionary<long, VirtualConnection>();
|
||||
|
||||
RunReadLoop();
|
||||
}
|
||||
|
||||
public Stream OpenVirtualConnection()
|
||||
{
|
||||
// Improve discoverability of read-loop errors (in case the developer doesn't add an OnError listener)
|
||||
ThrowIfReadLoopFailed();
|
||||
|
||||
var id = Interlocked.Increment(ref _nextInnerStreamId);
|
||||
var newInnerStream = new VirtualConnection(id, this);
|
||||
lock (_activeInnerStreams)
|
||||
{
|
||||
_activeInnerStreams.Add(id, newInnerStream);
|
||||
}
|
||||
|
||||
return newInnerStream;
|
||||
}
|
||||
|
||||
// It's async void because nothing waits for it to finish (it continues indefinitely). It signals any errors via
|
||||
// a separate channel.
|
||||
private async void RunReadLoop()
|
||||
{
|
||||
try
|
||||
{
|
||||
while (!_disposalCancellatonToken.IsCancellationRequested)
|
||||
{
|
||||
var remoteIsStillConnected = await ProcessNextFrameAsync();
|
||||
if (!remoteIsStillConnected)
|
||||
{
|
||||
CloseAllActiveStreams();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Not all underlying transports correctly honor cancellation tokens. For example,
|
||||
// DomainSocketStreamTransport's ReadAsync ignores them, so we only know to stop
|
||||
// the read loop when the underlying stream is disposed and then it throws ObjectDisposedException.
|
||||
if (!(ex is TaskCanceledException || ex is ObjectDisposedException))
|
||||
{
|
||||
_readLoopExitedWithException = ex;
|
||||
|
||||
var evt = OnError;
|
||||
if (evt != null)
|
||||
{
|
||||
evt(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> ProcessNextFrameAsync()
|
||||
{
|
||||
// First read frame header
|
||||
var frameHeaderBuffer = await ReadExactLength(12);
|
||||
if (frameHeaderBuffer == null)
|
||||
{
|
||||
return false; // Underlying stream was closed
|
||||
}
|
||||
|
||||
// Parse frame header, then read the frame body
|
||||
long streamId = BitConverter.ToInt64(frameHeaderBuffer, 0);
|
||||
int frameBodyLength = BitConverter.ToInt32(frameHeaderBuffer, 8);
|
||||
if (frameBodyLength < 0 || frameBodyLength > MaxFrameBodyLength)
|
||||
{
|
||||
throw new InvalidDataException("Illegal frame length: " + frameBodyLength);
|
||||
}
|
||||
|
||||
var frameBody = await ReadExactLength(frameBodyLength);
|
||||
if (frameBody == null)
|
||||
{
|
||||
return false; // Underlying stream was closed
|
||||
}
|
||||
|
||||
// Dispatch the frame to the relevant inner stream
|
||||
VirtualConnection innerStream;
|
||||
lock (_activeInnerStreams)
|
||||
{
|
||||
_activeInnerStreams.TryGetValue(streamId, out innerStream);
|
||||
}
|
||||
|
||||
if (innerStream != null)
|
||||
{
|
||||
await innerStream.AddDataToQueue(frameBody);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<byte[]> ReadExactLength(int lengthToRead) {
|
||||
byte[] buffer = new byte[lengthToRead];
|
||||
var totalBytesRead = 0;
|
||||
var ct = _disposalCancellatonToken.Token;
|
||||
while (totalBytesRead < lengthToRead)
|
||||
{
|
||||
var chunkLengthRead = await _underlyingTransport.ReadAsync(buffer, totalBytesRead, lengthToRead - totalBytesRead, ct);
|
||||
if (chunkLengthRead == 0)
|
||||
{
|
||||
// Underlying stream was closed
|
||||
return null;
|
||||
}
|
||||
|
||||
totalBytesRead += chunkLengthRead;
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private void CloseAllActiveStreams()
|
||||
{
|
||||
IList<VirtualConnection> innerStreamsCopy;
|
||||
|
||||
// Only hold the lock while cloning the list of inner streams. Release the lock before
|
||||
// actually disposing them, because each 'dispose' call will try to take another lock
|
||||
// so it can remove that inner stream from activeInnerStreams.
|
||||
lock (_activeInnerStreams)
|
||||
{
|
||||
innerStreamsCopy = _activeInnerStreams.Values.ToList();
|
||||
}
|
||||
|
||||
foreach (var stream in innerStreamsCopy)
|
||||
{
|
||||
stream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposedValue)
|
||||
{
|
||||
_disposedValue = true;
|
||||
|
||||
_disposalCancellatonToken.Cancel(); // Stops the read loop
|
||||
CloseAllActiveStreams();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task WriteAsync(long innerStreamId, byte[] data, int offset, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
// In case the amount of data to be sent exceeds the max frame length, split it into separate frames
|
||||
// Note that we always send at least one frame, even if it's empty, because the zero-length frame is the signal to close a virtual connection
|
||||
// (hence 'do..while' instead of just 'while').
|
||||
int bytesWritten = 0;
|
||||
do {
|
||||
// Improve discoverability of read-loop errors (in case the developer doesn't add an OnError listener)
|
||||
ThrowIfReadLoopFailed();
|
||||
|
||||
// Hold the write lock only for the time taken to send a single frame, not all frames, to allow large sends to be proceed in parallel
|
||||
await _streamWriterSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
// Write stream ID, then length prefix, then chunk payload, then flush
|
||||
var nextChunkBodyLength = Math.Min(MaxFrameBodyLength, count - bytesWritten);
|
||||
await _underlyingTransport.WriteAsync(BitConverter.GetBytes(innerStreamId), 0, 8, cancellationToken).ConfigureAwait(false);
|
||||
await _underlyingTransport.WriteAsync(BitConverter.GetBytes(nextChunkBodyLength), 0, 4, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (nextChunkBodyLength > 0)
|
||||
{
|
||||
await _underlyingTransport.WriteAsync(data, offset + bytesWritten, nextChunkBodyLength, cancellationToken).ConfigureAwait(false);
|
||||
bytesWritten += nextChunkBodyLength;
|
||||
}
|
||||
|
||||
await _underlyingTransport.FlushAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_streamWriterSemaphore.Release();
|
||||
}
|
||||
} while (bytesWritten < count);
|
||||
}
|
||||
|
||||
public void CloseInnerStream(long innerStreamId, bool isAlreadyClosedRemotely)
|
||||
{
|
||||
lock (_activeInnerStreams)
|
||||
{
|
||||
if (_activeInnerStreams.ContainsKey(innerStreamId))
|
||||
{
|
||||
_activeInnerStreams.Remove(innerStreamId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAlreadyClosedRemotely) {
|
||||
// Also notify the remote that this innerstream is closed
|
||||
WriteAsync(innerStreamId, new byte[0], 0, 0, new CancellationToken()).Wait();
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowIfReadLoopFailed()
|
||||
{
|
||||
if (_readLoopExitedWithException != null)
|
||||
{
|
||||
throw new AggregateException("The connection failed - see InnerException for details.", _readLoopExitedWithException);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
{
|
||||
"AssemblyIdentity": "Microsoft.AspNetCore.NodeServices.Sockets, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
|
||||
"Types": [
|
||||
{
|
||||
"Name": "Microsoft.AspNetCore.NodeServices.Sockets.NodeServicesOptionsExtensions",
|
||||
"Visibility": "Public",
|
||||
"Kind": "Class",
|
||||
"Abstract": true,
|
||||
"Static": true,
|
||||
"Sealed": true,
|
||||
"ImplementedInterfaces": [],
|
||||
"Members": [
|
||||
{
|
||||
"Kind": "Method",
|
||||
"Name": "UseSocketHosting",
|
||||
"Parameters": [
|
||||
{
|
||||
"Name": "options",
|
||||
"Type": "Microsoft.AspNetCore.NodeServices.NodeServicesOptions"
|
||||
}
|
||||
],
|
||||
"ReturnType": "System.Void",
|
||||
"Static": true,
|
||||
"Extension": true,
|
||||
"Visibility": "Public",
|
||||
"GenericParameter": []
|
||||
}
|
||||
],
|
||||
"GenericParameters": []
|
||||
},
|
||||
{
|
||||
"Name": "Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections.VirtualConnectionReadErrorHandler",
|
||||
"Visibility": "Public",
|
||||
"Kind": "Class",
|
||||
"Sealed": true,
|
||||
"BaseType": "System.MulticastDelegate",
|
||||
"ImplementedInterfaces": [],
|
||||
"Members": [
|
||||
{
|
||||
"Kind": "Method",
|
||||
"Name": "Invoke",
|
||||
"Parameters": [
|
||||
{
|
||||
"Name": "ex",
|
||||
"Type": "System.Exception"
|
||||
}
|
||||
],
|
||||
"ReturnType": "System.Void",
|
||||
"Virtual": true,
|
||||
"Visibility": "Public",
|
||||
"GenericParameter": []
|
||||
},
|
||||
{
|
||||
"Kind": "Method",
|
||||
"Name": "BeginInvoke",
|
||||
"Parameters": [
|
||||
{
|
||||
"Name": "ex",
|
||||
"Type": "System.Exception"
|
||||
},
|
||||
{
|
||||
"Name": "callback",
|
||||
"Type": "System.AsyncCallback"
|
||||
},
|
||||
{
|
||||
"Name": "object",
|
||||
"Type": "System.Object"
|
||||
}
|
||||
],
|
||||
"ReturnType": "System.IAsyncResult",
|
||||
"Virtual": true,
|
||||
"Visibility": "Public",
|
||||
"GenericParameter": []
|
||||
},
|
||||
{
|
||||
"Kind": "Method",
|
||||
"Name": "EndInvoke",
|
||||
"Parameters": [
|
||||
{
|
||||
"Name": "result",
|
||||
"Type": "System.IAsyncResult"
|
||||
}
|
||||
],
|
||||
"ReturnType": "System.Void",
|
||||
"Virtual": true,
|
||||
"Visibility": "Public",
|
||||
"GenericParameter": []
|
||||
},
|
||||
{
|
||||
"Kind": "Constructor",
|
||||
"Name": ".ctor",
|
||||
"Parameters": [
|
||||
{
|
||||
"Name": "object",
|
||||
"Type": "System.Object"
|
||||
},
|
||||
{
|
||||
"Name": "method",
|
||||
"Type": "System.IntPtr"
|
||||
}
|
||||
],
|
||||
"Visibility": "Public",
|
||||
"GenericParameter": []
|
||||
}
|
||||
],
|
||||
"GenericParameters": []
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"name": "nodeservices.sockets",
|
||||
"version": "1.0.0",
|
||||
"description": "This is not really an NPM package and will not be published. This file exists only to reference compilation tools.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "webpack --mode production"
|
||||
},
|
||||
"author": "Microsoft",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.9.2",
|
||||
"ts-loader": "^4.5.0",
|
||||
"typescript": "^3.0.1",
|
||||
"webpack": "^4.17.1",
|
||||
"webpack-cli": "^3.1.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
target: 'node',
|
||||
resolve: {
|
||||
extensions: [ '.ts' ]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.ts$/, use: 'ts-loader' },
|
||||
]
|
||||
},
|
||||
entry: {
|
||||
'entrypoint-socket': ['./TypeScript/SocketNodeInstanceEntryPoint'],
|
||||
},
|
||||
output: {
|
||||
libraryTarget: 'commonjs',
|
||||
path: path.join(__dirname, 'Content', 'Node'),
|
||||
filename: '[name].js'
|
||||
},
|
||||
optimization: {
|
||||
minimize: false
|
||||
}
|
||||
};
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/bin/
|
||||
/node_modules/
|
||||
yarn.lock
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es3",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>Helpers for building single-page applications on ASP.NET MVC Core.</Description>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<IsProductPackage>true</IsProductPackage>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.AspNetCore.SpaServices\Microsoft.AspNetCore.SpaServices.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="$(MicrosoftAspNetCoreWebSocketsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="$(MicrosoftExtensionsFileProvidersPhysicalPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# Where have all the SPA templates gone?
|
||||
|
||||
They are now in the [ASP.NET templating](https://github.com/aspnet/templating) repo.
|
||||
|
||||
This is so that all the ASP.NET templates (both SPA and non-SPA) can be built, tested, and packaged from a single location and always included automatically in future SDK builds.
|
||||
|
||||
### What about issues and pull requests?
|
||||
|
||||
If you have issues or comments about the SPA templates, please continue to post them [here in this repo](https://github.com/aspnet/JavaScriptServices/issues), because then you will reach a more relevant group of contributors than if you posted to `aspnet/templating`.
|
||||
|
||||
If you want to submit a pull request on the SPA templates, then of course you will neeed to submit that to the `aspnet/templating` repo, because that's where the code is now. But before doing so it's always a good idea to [post an issue on this repo](https://github.com/aspnet/JavaScriptServices/issues) describing what you want to do, so we can discuss whether or not such a PR would be accepted.
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>3.0.0</VersionPrefix>
|
||||
<VersionSuffix>alpha1</VersionSuffix>
|
||||
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' == 'rtm' ">$(VersionPrefix)</PackageVersion>
|
||||
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' != 'rtm' ">$(VersionPrefix)-$(VersionSuffix)-final</PackageVersion>
|
||||
<BuildNumber Condition="'$(BuildNumber)' == ''">t000</BuildNumber>
|
||||
<FeatureBranchVersionPrefix Condition="'$(FeatureBranchVersionPrefix)' == ''">a-</FeatureBranchVersionPrefix>
|
||||
<VersionSuffix Condition="'$(VersionSuffix)' != '' And '$(FeatureBranchVersionSuffix)' != ''">$(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-'))</VersionSuffix>
|
||||
<VersionSuffix Condition="'$(VersionSuffix)' != '' And '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -9,7 +9,7 @@ This NuGet package provides a fast and robust way to invoke Node.js code from a
|
|||
|
||||
It is the underlying mechanism supporting the following packages:
|
||||
|
||||
* [`Microsoft.AspNetCore.SpaServices`](https://github.com/aspnet/JavaScriptServices/tree/master/src/Microsoft.AspNetCore.SpaServices) - builds on NodeServices, adding functionality commonly used in Single Page Applications, such as server-side prerendering, webpack middleware, and integration between server-side and client-side routing.
|
||||
* [`Microsoft.AspNetCore.SpaServices`](/src/Middleware/SpaServices/) - builds on NodeServices, adding functionality commonly used in Single Page Applications, such as server-side prerendering, webpack middleware, and integration between server-side and client-side routing.
|
||||
|
||||
### Requirements
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ For .NET Framework apps:
|
|||
In that case, you don't need to use NodeServices directly (or install it manually). You can either:
|
||||
|
||||
* **Recommended:** Use the `aspnetcore-spa` Yeoman generator to get a ready-to-go starting point using your choice of client-side framework. [Instructions here.](http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/)
|
||||
* Or set up your ASP.NET Core and client-side Angular/React/KO/etc. app manually, and then use the [`Microsoft.AspNetCore.SpaServices`](https://github.com/aspnet/JavaScriptServices/tree/master/src/Microsoft.AspNetCore.SpaServices) package to add features like server-side prerendering or Webpack middleware. But really, at least try using the `aspnetcore-spa` generator first.
|
||||
* Or set up your ASP.NET Core and client-side Angular/React/KO/etc. app manually, and then use the [`Microsoft.AspNetCore.SpaServices`](/src/Middleware/SpaServices/) package to add features like server-side prerendering or Webpack middleware. But really, at least try using the `aspnetcore-spa` generator first.
|
||||
|
||||
# Simple usage example
|
||||
|
||||
|
|
@ -255,8 +255,6 @@ module.exports = function(result, physicalPath, maxWidth, maxHeight) {
|
|||
}
|
||||
```
|
||||
|
||||
There's a working image resizing example following this approach [here](../../samples/misc/NodeServicesExamples) - see the [C# code](../../samples/misc/NodeServicesExamples/Controllers/ResizeImage.cs) and the [JavaScript code](../../samples/misc/NodeServicesExamples/Node/resizeImage.js).
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `moduleName` - type: `string`
|
||||
|
|
@ -330,26 +328,6 @@ NodeServices is not meant to compete with Edge.js. Instead, NodeServices is an a
|
|||
|
||||
People have asked about using [VroomJS](https://github.com/fogzot/vroomjs) as a hosting mechanism. We don't currently plan to implement that, because Vroom only supplies a V8 runtime environment, not a complete Node environment. The difference is that, with a true Node environment, *all* NPM modules and Node code will work exactly as expected, whereas in a Vroom environment, code will only work if it doesn't use any Node primitives, which rules out large portions of the NPM landscape.
|
||||
|
||||
### Built-in hosting models
|
||||
|
||||
Normally, you can just use the default hosting model, and not worry about it. But if you have some special requirements, you can write your own hosting model, or reference a package that supplies one.
|
||||
|
||||
For example, you could use the 'socket' hosting model. It performs RPC between .NET and Node.js using a fast, low-level binary channel rather than the default HTTP transport. To do this, first install the NuGet package `Microsoft.AspNetCore.NodeServices.Sockets`. Then, at the top of your `Startup.cs` file, add:
|
||||
|
||||
```csharp
|
||||
using Microsoft.AspNetCore.NodeServices.Sockets;
|
||||
```
|
||||
|
||||
...then in your `Startup.cs` file's `ConfigureServices` method, you can configure:
|
||||
|
||||
```csharp
|
||||
services.AddNodeServices(options => {
|
||||
options.UseSocketHosting();
|
||||
});
|
||||
```
|
||||
|
||||
Now when you run your application, it will use the socket-based hosting and transport mechanism. In the past, the socket transport was faster than HTTP, but since .NET Core 1.1 improved the performance of `HttpClient` there isn't really any speed difference any more, so there's no longer any significant advantage to using `Microsoft.AspNetCore.NodeServices.Sockets`.
|
||||
|
||||
### Custom hosting models
|
||||
|
||||
If you implement a custom hosting model (by implementing `INodeInstance`), then you can cause it to be used by populating `NodeInstanceFactory` on your options:
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
|
||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNetCore.Mvc" />
|
||||
<Reference Include="Microsoft.AspNetCore.SpaServices" />
|
||||
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
|
||||
<Reference Include="Microsoft.AspNetCore.Hosting" />
|
||||
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
|
||||
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
|
||||
<Reference Include="Microsoft.AspNetCore.StaticFiles" />
|
||||
<Reference Include="Microsoft.Extensions.Logging.Debug" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
||||
<Exec Command="npm install" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
|
@ -12,9 +12,9 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(MicrosoftAspNetCoreHostingAbstractionsPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsPackageVersion)" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
|
||||
<Reference Include="Microsoft.AspNetCore.Hosting.Abstractions" />
|
||||
<Reference Include="Microsoft.Extensions.Logging.Console" />
|
||||
<Reference Include="Newtonsoft.Json" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue