This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/windows-containers-test' into dev
- Loading branch information
Showing
13 changed files
with
607 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# The MSI installs a service which is hard to override, so let's use a zip file. | ||
|
||
FROM microsoft/windowsservercore | ||
MAINTAINER alexellis2@gmail.com | ||
|
||
SHELL ["powershell"] | ||
RUN $ErrorActionPreference = 'Stop'; \ | ||
wget https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip -OutFile Redis-x64-3.2.100.zip ; \ | ||
Expand-Archive Redis-x64-3.2.100.zip -dest 'C:\\Program Files\\Redis\\' ; \ | ||
Remove-Item Redis-x64-3.2.100.zip -Force | ||
|
||
RUN setx PATH '%PATH%;C:\\Program Files\\Redis\\' | ||
WORKDIR 'C:\\Program Files\\Redis\\' | ||
|
||
|
||
|
||
RUN Get-Content redis.windows.conf | Where { $_ -notmatch 'bind 127.0.0.1' } | Set-Content redis.openport.conf ; \ | ||
Get-Content redis.openport.conf | Where { $_ -notmatch 'protected-mode yes' } | Set-Content redis.unprotected.conf ; \ | ||
Add-Content redis.unprotected.conf 'protected-mode no' ; \ | ||
Add-Content redis.unprotected.conf 'bind 0.0.0.0' ; \ | ||
Get-Content redis.unprotected.conf | ||
|
||
EXPOSE 6379 | ||
|
||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | ||
|
||
# Define our command to be run when launching the container | ||
CMD .\\redis-server.exe .\\redis.unprotected.conf --port 6379 ; \ | ||
Write-Host Redis Started... ; \ | ||
while ($true) { Start-Sleep -Seconds 3600 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM microsoft/dotnet:1.1-runtime-nanoserver | ||
ARG source | ||
WORKDIR /app | ||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | ||
EXPOSE 80 | ||
COPY ${source:-obj/Docker/publish} . | ||
ENTRYPOINT ["dotnet", "Basket.API.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM microsoft/dotnet:1.1-runtime-nanoserver | ||
ARG source | ||
WORKDIR /app | ||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | ||
EXPOSE 80 | ||
COPY ${source:-obj/Docker/publish} . | ||
ENTRYPOINT ["dotnet", "Catalog.API.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM microsoft/dotnet:1.1-runtime-nanoserver | ||
ARG source | ||
WORKDIR /app | ||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | ||
EXPOSE 80 | ||
COPY ${source:-obj/Docker/publish} . | ||
ENTRYPOINT ["dotnet", "Identity.API.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM microsoft/dotnet:1.1-runtime-nanoserver | ||
ARG source | ||
WORKDIR /app | ||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | ||
EXPOSE 80 | ||
COPY ${source:-obj/Docker/publish} . | ||
ENTRYPOINT ["dotnet", "Ordering.API.dll"] |
305 changes: 305 additions & 0 deletions
305
src/Web/Catalog.WebForms/Catalog.WebForms/Catalog.WebForms.csproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Autofac; | ||
using Autofac.Core; | ||
using eShopOnContainers.Core.Models.Catalog; | ||
using eShopOnContainers.Core.Services.Catalog; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Web; | ||
using System.Web.UI; | ||
using System.Web.UI.WebControls; | ||
|
||
namespace Microsoft.eShopOnContainers.Catalog.WebForms | ||
{ | ||
public partial class _Default : Page | ||
{ | ||
private ICatalogService catalog; | ||
|
||
protected _Default() { } | ||
|
||
public _Default(ICatalogService catalog) | ||
{ | ||
this.catalog = catalog; | ||
} | ||
|
||
protected override void OnLoad(EventArgs e) | ||
{ | ||
RegisterAsyncTask(new PageAsyncTask(LoadCatalogDataAsync)); | ||
|
||
base.OnLoad(e); | ||
} | ||
|
||
private async Task LoadCatalogDataAsync() | ||
{ | ||
var collection = await catalog?.GetCatalogAsync(); | ||
catalogList.DataSource = collection; | ||
catalogList.DataBind(); | ||
} | ||
|
||
protected void Page_Load(object sender, EventArgs e) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Web; | ||
using System.Web.Optimization; | ||
using System.Web.Routing; | ||
|
||
namespace Microsoft.eShopOnContainers.Catalog.WebForms | ||
{ | ||
public class Global : HttpApplication | ||
{ | ||
|
||
void Application_Start(object sender, EventArgs e) | ||
{ | ||
// Code that runs on application startup | ||
RouteConfig.RegisterRoutes(RouteTable.Routes); | ||
BundleConfig.RegisterBundles(BundleTable.Bundles); | ||
|
||
} | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
src/Web/Catalog.WebForms/Catalog.WebForms/Modules/AutoFacHttpModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using Autofac; | ||
using eShopOnContainers.Core.Services.Catalog; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Web.Configuration; | ||
using System.Web.UI; | ||
|
||
namespace Microsoft.eShopOnContainers.Catalog.WebForms.Modules | ||
{ | ||
// Using DI with WebForms is not yet implemented. | ||
// This implementation has been adapted from this post: | ||
// https://blogs.msdn.microsoft.com/webdev/2016/10/19/modern-asp-net-web-forms-development-dependency-injection/ | ||
|
||
public class AutoFacHttpModule : IHttpModule | ||
{ | ||
private static IContainer Container => lazyContainer.Value; | ||
|
||
private static Lazy<IContainer> lazyContainer = new Lazy<IContainer>(() => CreateContainer()); | ||
|
||
private static IContainer CreateContainer() | ||
{ | ||
// Configure AutoFac: | ||
// Register Containers: | ||
var settings = WebConfigurationManager.AppSettings; | ||
var useFake = settings["usefake"]; | ||
bool fake = useFake == "true"; | ||
var builder = new ContainerBuilder(); | ||
if (fake) | ||
{ | ||
builder.RegisterType<CatalogMockService>() | ||
.As<ICatalogService>(); | ||
} | ||
else | ||
{ | ||
builder.RegisterType<CatalogMockService>() | ||
.As<ICatalogService>(); | ||
} | ||
var container = builder.Build(); | ||
return container; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Container.Dispose(); | ||
} | ||
|
||
public void Init(HttpApplication context) | ||
{ | ||
context.PreRequestHandlerExecute += (_, __) => InjectDependencies(); | ||
} | ||
|
||
private void InjectDependencies() | ||
{ | ||
if (HttpContext.Current.CurrentHandler is Page page) | ||
{ | ||
// Get the code-behind class that we may have written | ||
var pageType = page.GetType().BaseType; | ||
|
||
// Determine if there is a constructor to inject, and grab it | ||
var ctor = (from c in pageType.GetConstructors() | ||
where c.GetParameters().Length > 0 | ||
select c).FirstOrDefault(); | ||
|
||
if (ctor != null) | ||
{ | ||
// Resolve the parameters for the constructor | ||
var args = (from parm in ctor.GetParameters() | ||
select Container.Resolve(parm.ParameterType)) | ||
.ToArray(); | ||
|
||
// Execute the constructor method with the arguments resolved | ||
ctor.Invoke(page, args); | ||
} | ||
|
||
// Use the Autofac method to inject any properties that can be filled by Autofac | ||
Container.InjectProperties(page); | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
For more information on how to configure your ASP.NET application, please visit | ||
https://go.microsoft.com/fwlink/?LinkId=169433 | ||
--> | ||
<configuration> | ||
<appSettings> | ||
<add key="usefake" value="true" /> | ||
</appSettings> | ||
<system.web> | ||
<compilation debug="true" targetFramework="4.5.2" /> | ||
<httpRuntime targetFramework="4.5.2" /> | ||
<pages> | ||
<namespaces> | ||
<add namespace="System.Web.Optimization" /> | ||
</namespaces> | ||
<controls> | ||
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /> | ||
</controls> | ||
</pages> | ||
<httpModules> | ||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> | ||
<!-- Use this if you are on IIS 7 and earlier --> | ||
<add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" /> | ||
</httpModules> | ||
</system.web> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /> | ||
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<system.webServer> | ||
<validation validateIntegratedModeConfiguration="false" /> | ||
<modules> | ||
<remove name="ApplicationInsightsWebTracking" /> | ||
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> | ||
<!-- Use this if you are on IIS 8 and later --> | ||
<add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" /> | ||
</modules> | ||
</system.webServer> | ||
<system.codedom> | ||
<compilers> | ||
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> | ||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /> | ||
</compilers> | ||
</system.codedom> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Antlr" version="3.4.1.9004" targetFramework="net452" /> | ||
<package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net452" /> | ||
<package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net452" /> | ||
<package id="Autofac" version="4.3.0" targetFramework="net452" /> | ||
<package id="bootstrap" version="3.0.0" targetFramework="net452" /> | ||
<package id="jQuery" version="1.10.2" targetFramework="net452" /> | ||
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" /> | ||
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" /> | ||
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" /> | ||
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net452" /> | ||
<package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net452" /> | ||
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net452" /> | ||
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net452" /> | ||
<package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net452" /> | ||
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net452" /> | ||
<package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net452" /> | ||
<package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net452" /> | ||
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" /> | ||
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net452" /> | ||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" /> | ||
<package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net452" developmentDependency="true" /> | ||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" /> | ||
<package id="Modernizr" version="2.6.2" targetFramework="net452" /> | ||
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" /> | ||
<package id="Respond" version="1.2.0" targetFramework="net452" /> | ||
<package id="WebGrease" version="1.5.2" targetFramework="net452" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM microsoft/dotnet:1.1-runtime-nanoserver | ||
ARG source | ||
WORKDIR /app | ||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | ||
EXPOSE 80 | ||
COPY ${source:-obj/Docker/publish} . | ||
ENTRYPOINT ["dotnet", "WebMVC.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM microsoft/dotnet:1.1-runtime-nanoserver | ||
ARG source | ||
WORKDIR /app | ||
RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord | ||
EXPOSE 80 | ||
COPY ${source:-obj/Docker/publish} . | ||
ENTRYPOINT ["dotnet", "WebSPA.dll"] |