Adding server code. Fixing IIS application deployment.
authorCristian Pop <Cristian.Pop@microsoft.com>
Tue, 5 Jul 2016 23:44:19 +0000 (16:44 -0700)
committerCristian Pop <Cristian.Pop@microsoft.com>
Wed, 13 Jul 2016 22:29:11 +0000 (15:29 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/cb0becbb7e546ffa5f265f862e76bc0fa445ec50

57 files changed:
src/libraries/Common/tests/Scripts/Prerequisites/config.ps1 [deleted file]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/config.ps1 [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup.ps1 with 94% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup_activedirectory_client.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup_activedirectory_client.ps1 with 100% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup_activedirectory_domaincontroller.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup_activedirectory_domaincontroller.ps1 with 98% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup_certificates.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup_certificates.ps1 with 100% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup_client.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup_client.ps1 with 100% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup_common.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup_common.ps1 with 63% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup_firewall.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup_firewall.ps1 with 100% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/Deployment/setup_iisserver.ps1 [moved from src/libraries/Common/tests/Scripts/Prerequisites/setup_iisserver.ps1 with 84% similarity]
src/libraries/Common/tests/System/Net/Prerequisites/README.md [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService.sln [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/CoreFxNetCloudService.ccproj [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Cloud.cscfg [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Local.cscfg [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceDefinition.csdef [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/WebServerContent/diagnostics.wadcfgx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ecf/WebServerContent/diagnostics.wadcfgx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/AuthenticationHelper.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/ContentHelper.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/NameValueCollectionConverter.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/AssemblyInfo.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_CHK.pubxml [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_RET.pubxml [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestHelper.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestInformation.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Debug.config [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Release.config [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.config [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebRole.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebServer.csproj [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/Default.htm [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/index.html [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/packages.config [new file with mode: 0644]
src/libraries/Common/tests/System/Net/Prerequisites/Servers/buildAndPackage.ps1 [new file with mode: 0644]
src/libraries/System.Net.Http/tests/FunctionalTests/DefaultCredentialsTest.cs
src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj

diff --git a/src/libraries/Common/tests/Scripts/Prerequisites/config.ps1 b/src/libraries/Common/tests/Scripts/Prerequisites/config.ps1
deleted file mode 100644 (file)
index a608206..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-# See the LICENSE file in the project root for more information.
-
-#
-# CoreFX - Net configuration
-#
-
-# -- Machine selection
-
-# You can find the host name by logging on to the target machine and typing "hostname" in a cmd console.
-# You can find the IP address by logging on to the target machine and typing "ipconfig" in a cmd console.
-# Requirements:
-#  - The machines below should be within the same LAN network.
-#  - All machines must have Powershell >3.0 installed. 
-
-# IMPORTANT: 
-#           The state for the following machines will be changed irreversably. 
-#           The uninstall step will remove the installed components regardless if it existed before the deployment or
-#           was altered/customized after deployment. 
-#
-
-# A Windows Server SKU hosting Active Directory services. This machine will become the Domain Controller:
-$COREFX_NET_AD_Machine = ""         #Example: "TESTAD"
-$COREFX_NET_AD_MachineIP = ""         #Example: "192.168.0.1" - must be a Static IPv4 address.
-
-# A Windows Client or Server SKU hosting the IIS Server. This machine will be joined to the Domain.
-$COREFX_NET_IISSERVER_Machine = ""  #Example: "TESTIIS"
-$COREFX_NET_IISSERVER_MachineIP = ""        #Example: "192.168.0.1" - must be a Static IPv4 address.
-
-# A Windows Client or Server SKU hosting the corefx enlistment. This machine will be joined to the Domain.
-$COREFX_NET_CLIENT_Machine = ""     #Example: "TESTCLIENT"
-
-# -- Test parameters
-
-# For security reasons, it's advisable that the default username/password pairs below are changed regularly.
-
-$script:domainName = "corp.contoso.com"
-$script:domainNetbios = "corefx-net-ad"
-
-$script:domainUserName = "testaduser"
-$script:domainUserPassword = "Test-ADPassword"
-
-$script:basicUserName = "testbasic"
-$script:basicUserPassword = "Test-Basic"
-
-# Changing the IISServer FQDN may require changing certificates.
-$script:iisServerFQDN = "testserver.contoso.com"
-
-$script:PreRebootRoles = @(
-    @{Name = "COREFX_NET_AD_CLIENT"; Script = "setup_activedirectory_client.ps1"; MachineName = $COREFX_NET_IISSERVER_Machine},
-    @{Name = "COREFX_NET_AD_CLIENT"; Script = "setup_activedirectory_client.ps1"; MachineName = $COREFX_NET_CLIENT_Machine},
-    @{Name = "COREFX_NET_AD_DC"; Script = "setup_activedirectory_domaincontroller.ps1"; MachineName = $COREFX_NET_AD_Machine; MachineIP = $COREFX_NET_AD_MachineIP}
-)
-
-$script:Roles = @(
-    @{Name = "COREFX_NET_IISSERVER"; Script = "setup_iisserver.ps1"; MachineName = $COREFX_NET_IISSERVER_Machine; MachineIP = $COREFX_NET_IISSERVER_MachineIP},
-    @{Name = "COREFX_NET_CLIENT"; Script = "setup_client.ps1"; MachineName = $COREFX_NET_CLIENT_Machine},
-    @{Name = "COREFX_NET_AD_DC"; Script = "setup_activedirectory_domaincontroller.ps1"; MachineName = $COREFX_NET_AD_Machine; MachineIP = $COREFX_NET_AD_MachineIP}
-)
-
-# The following variable names should match the ones read by Configuration.*.cs code.
-$script:ClientConfiguration = @(
-
-# TODO #9048: 
-    # Configuration.Http:
-#    @{Name = "COREFX_HTTPHOST"; Value = $script:iisServerFQDN},
-#    @{Name = "COREFX_SECUREHTTPHOST"; Value = $script:iisServerFQDN},
-#    @{Name = "COREFX_HTTP2HOST"; Value = $script:iisServerFQDN},                # Requires Windows 10 and above.
-#    @{Name = "COREFX_DOMAINJOINED_HTTPHOST"; Value = $script:iisServerFQDN},
-#    @{Name = "COREFX_DOMAINJOINED_PROXYHOST"; Value = $null},                   # TODO 9048: Install & configure ISA/TMG or Squid
-#    @{Name = "COREFX_DOMAINJOINED_PROXYPORT"; Value = $null},                   # TODO 9048: Install & configure ISA/TMG or Squid
-#    @{Name = "COREFX_HTTPHOST_SSL2"; Value = $null},                            # TODO 9048: move to a localhost server or configure these websites.
-#    @{Name = "COREFX_HTTPHOST_SSL3"; Value = $null},
-#    @{Name = "COREFX_HTTPHOST_TLS10"; Value = $null},
-#    @{Name = "COREFX_HTTPHOST_TLS11"; Value = $null},
-#    @{Name = "COREFX_HTTPHOST_TLS12"; Value = $null},
-#    @{Name = "COREFX_HTTPHOST_EXPIREDCERT"; Value = $null},
-#    @{Name = "COREFX_HTTPHOST_WRONGHOSTNAME"; Value = $null},
-#    @{Name = "COREFX_HTTPHOST_SELFSIGNEDCERT"; Value = $null},
-#    @{Name = "COREFX_HTTPHOST_REVOKEDCERT"; Value = $null},
-#    @{Name = "COREFX_STRESS_HTTP"; Value = "1"},
-
-    # Configuration.WebSockets:
-#    @{Name = "COREFX_WEBSOCKETHOST"; Value = $script:domainNetbios},
-#    @{Name = "COREFX_SECUREWEBSOCKETHOST"; Value = $script:domainNetbios},
-
-    # Configuration.Security:
-    @{Name = "COREFX_NET_AD_DOMAINNAME"; Value = $script:domainNetbios},
-    @{Name = "COREFX_NET_AD_USERNAME"; Value = $script:domainUserName},
-    @{Name = "COREFX_NET_AD_PASSWORD"; Value = $script:domainUserPassword},
-    @{Name = "COREFX_NET_SECURITY_NEGOSERVERURI"; Value = "http://$($script:iisServerFQDN)"},
-    @{Name = "COREFX_NET_SECURITY_TLSSERVERURI"; Value = "https://$($script:iisServerFQDN)"},
-
-    @{Name = "COREFX_NET_SOCKETS_SERVERURI"; Value = "http://$($script:iisServerFQDN)"}
-)
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Deployment/config.ps1 b/src/libraries/Common/tests/System/Net/Prerequisites/Deployment/config.ps1
new file mode 100644 (file)
index 0000000..04a2243
--- /dev/null
@@ -0,0 +1,60 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+#
+# CoreFX - Net configuration
+#
+
+# -- Machine Information
+
+# You can find the host name by logging on to the target machine and typing "hostname" in a cmd console.
+# You can find the IP address by logging on to the target machine and typing "ipconfig" in a cmd console.
+# Requirements:
+#  - The machines below should be within the same LAN network.
+#  - All machines must have Powershell >3.0 installed. 
+
+# IMPORTANT: 
+#           The state for the following machines will be changed irreversably. 
+#           The uninstall step will remove the installed components regardless if it existed before the deployment or
+#           was altered/customized after deployment. 
+#
+
+# A Windows Server SKU hosting Active Directory services. This machine will become the Domain Controller:
+$COREFX_NET_AD_Machine = ""             #Example: "TESTAD"
+$COREFX_NET_AD_MachineIP = ""           #Example: "192.168.0.1" - must be a Static IPv4 address.
+
+# A Windows Client or Server SKU hosting the IIS Server. This machine will be joined to the Domain.
+$COREFX_NET_IISSERVER_Machine = ""      #Example: "TESTIIS"
+$COREFX_NET_IISSERVER_MachineIP = ""    #Example: "192.168.0.1" - must be a Static IPv4 address.
+
+# A Windows Client or Server SKU hosting the corefx enlistment. This machine will be joined to the Domain.
+$COREFX_NET_CLIENT_Machine = ""         #Example: "TESTCLIENT"
+
+# -- Test Parameters
+
+# For security reasons, it's advisable that the default username/password pairs below are changed regularly.
+
+$script:domainName = "corp.contoso.com"
+$script:domainNetbios = "corefx-net-ad"
+
+$script:domainUserName = "testaduser"
+$script:domainUserPassword = "Test-ADPassword"
+
+$script:basicUserName = "testbasic"
+$script:basicUserPassword = "Test-Basic"
+
+# Changing the IISServer FQDN may require changing certificates.
+$script:iisServerFQDN = "testserver.contoso.com"
+
+$script:PreRebootRoles = @(
+    @{Name = "COREFX_NET_AD_CLIENT"; Script = "setup_activedirectory_client.ps1"; MachineName = $COREFX_NET_IISSERVER_Machine},
+    @{Name = "COREFX_NET_AD_CLIENT"; Script = "setup_activedirectory_client.ps1"; MachineName = $COREFX_NET_CLIENT_Machine},
+    @{Name = "COREFX_NET_AD_DC"; Script = "setup_activedirectory_domaincontroller.ps1"; MachineName = $COREFX_NET_AD_Machine; MachineIP = $COREFX_NET_AD_MachineIP}
+)
+
+$script:Roles = @(
+    @{Name = "COREFX_NET_IISSERVER"; Script = "setup_iisserver.ps1"; MachineName = $COREFX_NET_IISSERVER_Machine; MachineIP = $COREFX_NET_IISSERVER_MachineIP},
+    @{Name = "COREFX_NET_CLIENT"; Script = "setup_client.ps1"; MachineName = $COREFX_NET_CLIENT_Machine},
+    @{Name = "COREFX_NET_AD_DC"; Script = "setup_activedirectory_domaincontroller.ps1"; MachineName = $COREFX_NET_AD_Machine; MachineIP = $COREFX_NET_AD_MachineIP}
+)
@@ -39,6 +39,13 @@ Function TestMachineStatus($role)
 
 Function CheckRoles
 {
+    Write-Host "Verifying server applications:"
+    $iisApplications = GetIISCodePath
+    if (-not (Test-Path (Join-Path $iisApplications "index.html")))
+    {
+        throw "Cannot find index.html within the $iisApplications path. Make sure that you have built and copied the Server code before running this script."
+    }
+
     Write-Host "Verifying roles:"
     foreach ($role in ($script:Roles + $script:PreRebootRoles))
     {
@@ -93,10 +100,7 @@ Function CreateDestinationPath($s)
 
 Function CopyScripts($s, $remotePath)
 {
-    foreach ($file in (dir *.ps1))
-    {
-        Copy-Item -Force -Path $file -Destination $remotePath -ToSession $s -ErrorAction Stop
-    }
+    Copy-Item -Recurse -Force -Path ".\*" -Destination $remotePath -ToSession $s -ErrorAction Stop
 }
 
 Function InstallRoles
@@ -4,6 +4,41 @@
 
 . .\config.ps1
 
+# The following variable names should match the ones read by Configuration.*.cs code.
+$script:ClientConfiguration = @(
+
+    # Configuration.Http:
+    @{Name = "COREFX_HTTPHOST"; Value = $script:iisServerFQDN},
+    @{Name = "COREFX_SECUREHTTPHOST"; Value = $script:iisServerFQDN},
+    @{Name = "COREFX_HTTP2HOST"; Value = $script:iisServerFQDN},                # Requires Windows 10 and above.
+    @{Name = "COREFX_DOMAINJOINED_HTTPHOST"; Value = $script:iisServerFQDN},
+    @{Name = "COREFX_DOMAINJOINED_PROXYHOST"; Value = $null},
+    @{Name = "COREFX_DOMAINJOINED_PROXYPORT"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_SSL2"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_SSL3"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_TLS10"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_TLS11"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_TLS12"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_EXPIREDCERT"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_WRONGHOSTNAME"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_SELFSIGNEDCERT"; Value = $null},
+    @{Name = "COREFX_HTTPHOST_REVOKEDCERT"; Value = $null},
+    @{Name = "COREFX_STRESS_HTTP"; Value = "1"},
+
+    # Configuration.WebSockets:
+    @{Name = "COREFX_WEBSOCKETHOST"; Value = $script:iisServerFQDN},
+    @{Name = "COREFX_SECUREWEBSOCKETHOST"; Value = $script:iisServerFQDN},
+
+    # Configuration.Security:
+    @{Name = "COREFX_NET_AD_DOMAINNAME"; Value = $script:domainNetbios},
+    @{Name = "COREFX_NET_AD_USERNAME"; Value = $script:domainUserName},
+    @{Name = "COREFX_NET_AD_PASSWORD"; Value = $script:domainUserPassword},
+    @{Name = "COREFX_NET_SECURITY_NEGOSERVERURI"; Value = "http://$($script:iisServerFQDN)"},
+    @{Name = "COREFX_NET_SECURITY_TLSSERVERURI"; Value = "https://$($script:iisServerFQDN)"},
+
+    @{Name = "COREFX_NET_SOCKETS_SERVERURI"; Value = "http://$($script:iisServerFQDN)"}
+)
+
 Function GetRoleForMachine($machineName)
 {
     return $script:Roles | where {$_.MachineName.ToUpper() -eq $machineName.ToUpper()}
@@ -108,3 +143,8 @@ Function DownloadFile($source, $destination)
         $wc.Downloadfile($source, $fqDestination.ToString())
     }
 }
+
+Function GetIISCodePath
+{
+    return ".\IISApplications"
+}
@@ -19,23 +19,20 @@ Param (
 . .\setup_firewall.ps1
 
 # Server application configuration
-$script:serverCodeUri = "https://github.com/davidsh/corefx-net-testservers/archive/master.zip"
-$script:serverCodeZip = "serverCode"
 $script:iisWwwRoot = "$env:systemdrive\inetpub\wwwroot"
-$script:serverCodeRootPath = "$($script:serverCodeZip)\corefx-net-testservers-master\CoreFxNetCloudService"
 $script:defaultWebSite = "Default Web Site"
 
 $script:webApps = @(
     @{Name = "NoAuth"; 
         IISRelativePath = ""; 
-        SourceRelativePath = "WebServer"; 
+        SourceRelativePath = ".\"; 
 
         Configuration = @()
      },
 
     @{Name = "BasicAuth"; 
         IISRelativePath = "BasicAuth"; 
-        SourceRelativePath = "WebServer"; 
+        SourceRelativePath = "\"; 
         Configuration  = @(
             @{ Path = "/system.webServer/security/authentication/anonymousAuthentication"; Name = "Enabled"; Value = "False" }
             @{ Path = "/system.webServer/security/authentication/basicAuthentication"; Name = "Enabled"; Value = "True" }
@@ -45,7 +42,7 @@ $script:webApps = @(
 
     @{Name = "DigestAuth"; 
         IISRelativePath = "DigestAuth"; 
-        SourceRelativePath = "WebServer"; 
+        SourceRelativePath = "\"; 
         Configuration  = @(
             @{ Path = "/system.webServer/security/authentication/anonymousAuthentication"; Name = "Enabled"; Value = "False" }
             @{ Path = "/system.webServer/security/authentication/digestAuthentication"; Name = "Enabled"; Value = "True" }
@@ -55,7 +52,7 @@ $script:webApps = @(
 
     @{Name = "WindowsAuth"; 
         IISRelativePath = "WindowsAuth"; 
-        SourceRelativePath = "WebServer";
+        SourceRelativePath = "\";
         Configuration  = @(
             @{ Path = "/system.webServer/security/authentication/anonymousAuthentication"; Name = "Enabled"; Value = "False" }
             @{ Path = "/system.webServer/security/authentication/windowsAuthentication"; Name = "Enabled"; Value = "True" }
@@ -92,23 +89,6 @@ Function RemoveLocalUser
     Remove-LocalUser $script:basicUserName -Confirm:$false
 }
 
-Function DeleteTemporaryFiles
-{
-    if (Test-Path $script:serverCodeZip)
-    {
-        rmdir $script:serverCodeZip -Recurse -Force 
-    }
-    
-    del ($script:serverCodeZip + ".zip") -ErrorAction SilentlyContinue
-}
-
-Function DownloadServerCode
-{
-    DeleteTemporaryFiles
-    DownloadFile $script:serverCodeUri ($script:serverCodeZip + ".zip")
-    Expand-Archive ($script:serverCodeZip + ".zip")
-}
-
 Function ConfigureWebSites
 {
     Write-Host -ForegroundColor Cyan "Configuring IIS websites."
@@ -136,10 +116,8 @@ Function GrantUserAccess($path, $userAccess)
 
 Function InstallServerCode
 {
-    Write-Host -ForegroundColor Cyan "Acquiring server code."
-    DownloadServerCode
-    
     Write-Host -ForegroundColor Cyan "Installing applications."
+    $serverCodeRootPath = GetIISCodePath
 
     foreach ($app in $script:webApps)
     {
@@ -156,7 +134,7 @@ Function InstallServerCode
 
         Write-Host "`tAdding $($app.Name)"
 
-        $tempPath = Join-Path $script:serverCodeRootPath $app.SourceRelativePath
+        $tempPath = Join-Path $serverCodeRootPath $app.SourceRelativePath
         mkdir $appPath -ErrorAction SilentlyContinue | Out-Null
         Copy-Item ($tempPath + "\*") $appPath -Recurse -ErrorAction Stop
         
@@ -169,9 +147,6 @@ Function InstallServerCode
 
         GrantUserAccess $appPath $app.UserAccess
     }
-    
-    Write-Host "Removing temporary files."
-    DeleteTemporaryFiles
 }
 
 Function RemoveServerCode
@@ -198,8 +173,6 @@ Function Install
     InstallServerFirewall
 
     EnvironmentSetInstalledRoleStatus
-    # TODO:
-    # - Grant AD user permissions for all auth methods and sites.
 }
 
 Function Uninstall
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/README.md b/src/libraries/Common/tests/System/Net/Prerequisites/README.md
new file mode 100644 (file)
index 0000000..568c1c3
--- /dev/null
@@ -0,0 +1,44 @@
+# System.Net Test Prerequisites
+Contains source files for the networking test servers in Azure or a private IIS deployment.
+
+## Deployment Instructions for a private multi-machine environment
+
+### Configuration
+
+1. Open .\Deployment\config.ps1 in an editor.
+2. Fill in the _Machine Selection_ section with the names and IP addresses of the target machines. In most cases the default options for _Test Parameters_ should be enough.
+
+Note: the `config.ps1` file has been added to .gitignore to prevent it being updated in the master branch.
+
+### Build the server applications 
+
+From a Visual Studio command prompt:
+
+```
+    powershell
+    cd .\Servers
+    .\buildAndPackage.ps1
+```
+
+You should now find a folder named `IISApplications` within the Deployment folder.
+
+### (only once) Create the Active Directory and join all machines
+
+Skip this step if previously completed and all machines are already part of a domain to which you have Administrator rights.
+This will join all machines to a test Active Directory and enable Windows Remoting.
+
+1. Copy the Deployment folder to each of the machines. 
+2. Run the .\setup.ps1 script on the machine designated to become the Domain Controller. Once complete, the machine will reboot.
+3. Run the .\setup.ps1 script on all other domain joined machines. Once complete, the machines will reboot.
+
+### Install or Update the environment
+
+Running as the Active Directory Administrator, run .\setup.ps1 from the client machine's enlistment. 
+The script will use WinRM to connect and update all other roles.
+
+## Deployment Instructions to update the Azure-based environment
+
+1. Create a _Classic_ Azure WebService role.
+2. Create a server certificate and add it to the subscription with the name: `CoreFxNetCertificate`
+3. Edit `Servers\CoreFxNetCloudService\CoreFxNetCloudService\ServiceConfiguration.Cloud.cscfg` and ensure that the `CoreFxNetCertificate` `thumbprint` and `thumbprintAlgorithm` are correct.
+4. Open the solution in Visual Studio and Run the Azure Publishing wizard to create and deploy the application.
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService.sln b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService.sln
new file mode 100644 (file)
index 0000000..b905dfa
--- /dev/null
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25123.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{CC5FD16D-436D-48AD-A40C-5A424C6E3E79}") = "CoreFxNetCloudService", "CoreFxNetCloudService\CoreFxNetCloudService.ccproj", "{57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServer", "WebServer\WebServer.csproj", "{6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Any CPU = Debug|Any CPU
+               Release|Any CPU = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {57E639CE-BD4D-4CB3-A913-AE51E18CD4A0}.Release|Any CPU.Build.0 = Release|Any CPU
+               {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}.Release|Any CPU.Build.0 = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/CoreFxNetCloudService.ccproj b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/CoreFxNetCloudService.ccproj
new file mode 100644 (file)
index 0000000..b5c547f
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>2.9</ProductVersion>
+    <ProjectGuid>57e639ce-bd4d-4cb3-a913-ae51e18cd4a0</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>CoreFxNetCloudService</RootNamespace>
+    <AssemblyName>CoreFxNetCloudService</AssemblyName>
+    <StartDevelopmentStorage>True</StartDevelopmentStorage>
+    <Name>CoreFxNetCloudService</Name>
+    <PackageEnableRemoteDebugger>False</PackageEnableRemoteDebugger>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <!-- Items for the project -->
+  <ItemGroup>
+    <ServiceDefinition Include="ServiceDefinition.csdef" />
+    <ServiceConfiguration Include="ServiceConfiguration.Local.cscfg" />
+    <ServiceConfiguration Include="ServiceConfiguration.Cloud.cscfg" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\WebServer\WebServer.csproj">
+      <Name>WebServer</Name>
+      <Project>{6acff710-5f63-4e46-b0da-0d1fe36ef4a7}</Project>
+      <Private>True</Private>
+      <RoleType>Web</RoleType>
+      <RoleName>WebServer</RoleName>
+      <UpdateDiagnosticsConnectionStringOnPublish>True</UpdateDiagnosticsConnectionStringOnPublish>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="WebServerContent\" />
+  </ItemGroup>
+  <ItemGroup>
+    <DiagnosticsConfiguration Include="WebServerContent\diagnostics.wadcfgx" />
+  </ItemGroup>
+  <!-- Import the target files for this project template -->
+  <PropertyGroup>
+    <VisualStudioVersion Condition=" '$(VisualStudioVersion)' == '' ">10.0</VisualStudioVersion>
+    <CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\2.9\</CloudExtensionsDir>
+  </PropertyGroup>
+  <Import Project="$(CloudExtensionsDir)Microsoft.WindowsAzure.targets" />
+</Project>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Cloud.cscfg b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Cloud.cscfg
new file mode 100644 (file)
index 0000000..b86cecd
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ServiceConfiguration serviceName="CoreFxNetCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">
+  <Role name="WebServer">
+    <Certificates>
+      <Certificate name="CoreFxNetCertificate" thumbprint="c8b01fb0b555e620fdfb7ae33de8e520c2ebe872" thumbprintAlgorithm="sha1" />
+      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="5439D7FF5B2041A2EC0B3DD7D6128C7E577D649F" thumbprintAlgorithm="sha1" />
+    </Certificates>
+    <Instances count="2" />
+    <ConfigurationSettings>
+      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=false" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="" />
+    </ConfigurationSettings>
+  </Role>
+</ServiceConfiguration>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Local.cscfg b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceConfiguration.Local.cscfg
new file mode 100644 (file)
index 0000000..7b9e8a7
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ServiceConfiguration serviceName="CoreFxNetCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2015-04.2.6">
+  <Role name="WebServer">
+    <Certificates>
+      <Certificate name="CoreFxNetCertificate" thumbprint="c8b01fb0b555e620fdfb7ae33de8e520c2ebe872" thumbprintAlgorithm="sha1" />
+      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="5439D7FF5B2041A2EC0B3DD7D6128C7E577D649F" thumbprintAlgorithm="sha1" />
+    </Certificates>
+    <Instances count="1" />
+    <ConfigurationSettings>
+      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="" />
+      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="" />
+    </ConfigurationSettings>
+  </Role>
+</ServiceConfiguration>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceDefinition.csdef b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ServiceDefinition.csdef
new file mode 100644 (file)
index 0000000..ca934aa
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ServiceDefinition name="CoreFxNetCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
+  <WebRole name="WebServer" vmsize="Medium">
+    <Certificates>
+      <Certificate name="CoreFxNetCertificate" storeLocation="LocalMachine" storeName="My" />
+    </Certificates>
+    <Sites>
+      <Site name="Web">
+        <Bindings>
+          <Binding name="Endpoint1" endpointName="Endpoint1" />
+          <Binding name="HttpsIn" endpointName="HttpsIn" />
+        </Bindings>
+      </Site>
+    </Sites>
+    <ConfigurationSettings>
+      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
+    </ConfigurationSettings>
+    <Endpoints>
+      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
+      <InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="CoreFxNetCertificate" />
+    </Endpoints>
+    <Imports>
+      <Import moduleName="RemoteAccess" />
+      <Import moduleName="RemoteForwarder" />
+    </Imports>
+  </WebRole>
+</ServiceDefinition>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/WebServerContent/diagnostics.wadcfgx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/WebServerContent/diagnostics.wadcfgx
new file mode 100644 (file)
index 0000000..4ff2f0a
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<DiagnosticsConfiguration  xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
+  <PublicConfig>
+    <WadCfg>
+      <DiagnosticMonitorConfiguration overallQuotaInMB="4096">
+        <DiagnosticInfrastructureLogs scheduledTransferLogLevelFilter="Error"/>
+        <Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Error" />
+        <Directories scheduledTransferPeriod="PT1M">
+          <IISLogs containerName ="wad-iis-logfiles" />
+          <FailedRequestLogs containerName ="wad-failedrequestlogs" />
+        </Directories>
+        <WindowsEventLog scheduledTransferPeriod="PT1M" >
+          <DataSource name="Application!*[System[(Level=1 or Level=2 or Level=3)]]" />
+          <DataSource name="Windows Azure!*[System[(Level=1 or Level=2 or Level=3 or Level=4)]]" />
+        </WindowsEventLog>
+        <CrashDumps containerName="wad-crashdumps" dumpType="Mini">
+          <CrashDumpConfiguration processName="WaIISHost.exe"/>
+          <CrashDumpConfiguration processName="WaWorkerHost.exe"/>
+          <CrashDumpConfiguration processName="w3wp.exe"/>
+        </CrashDumps>
+        <PerformanceCounters scheduledTransferPeriod="PT1M">
+          <PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\ISAPI Extension Requests/sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Bytes Total/Sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Requests/Sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Errors Total/Sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Queued" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Rejected" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT3M" />
+        </PerformanceCounters>
+      </DiagnosticMonitorConfiguration>
+    </WadCfg>
+    <StorageAccount></StorageAccount>
+  </PublicConfig>
+  <PrivateConfig>
+    <StorageAccount name="" key="" endpoint="" />
+  </PrivateConfig>
+  <IsEnabled>true</IsEnabled>
+</DiagnosticsConfiguration>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ecf/WebServerContent/diagnostics.wadcfgx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/CoreFxNetCloudService/ecf/WebServerContent/diagnostics.wadcfgx
new file mode 100644 (file)
index 0000000..b85e92a
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<DiagnosticsConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
+  <PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
+    <WadCfg>
+      <DiagnosticMonitorConfiguration overallQuotaInMB="4096">
+        <DiagnosticInfrastructureLogs scheduledTransferLogLevelFilter="Error" />
+        <Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Error" />
+        <Directories scheduledTransferPeriod="PT1M">
+          <IISLogs containerName="wad-iis-logfiles" />
+          <FailedRequestLogs containerName="wad-failedrequestlogs" />
+        </Directories>
+        <WindowsEventLog scheduledTransferPeriod="PT1M">
+          <DataSource name="Application!*[System[(Level=1 or Level=2 or Level=3)]]" />
+          <DataSource name="Windows Azure!*[System[(Level=1 or Level=2 or Level=3 or Level=4)]]" />
+        </WindowsEventLog>
+        <CrashDumps containerName="wad-crashdumps" dumpType="Mini">
+          <CrashDumpConfiguration processName="WaIISHost.exe" />
+          <CrashDumpConfiguration processName="WaWorkerHost.exe" />
+          <CrashDumpConfiguration processName="w3wp.exe" />
+        </CrashDumps>
+        <PerformanceCounters scheduledTransferPeriod="PT1M">
+          <PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\ISAPI Extension Requests/sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Bytes Total/Sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Requests/Sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Errors Total/Sec" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Queued" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Rejected" sampleRate="PT3M" />
+          <PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT3M" />
+        </PerformanceCounters>
+      </DiagnosticMonitorConfiguration>
+    </WadCfg>
+    <StorageAccount>devstoreaccount1</StorageAccount>
+  </PublicConfig>
+  <PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
+    <StorageAccount name="devstoreaccount1" key="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" />
+  </PrivateConfig>
+  <IsEnabled>true</IsEnabled>
+</DiagnosticsConfiguration>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/AuthenticationHelper.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/AuthenticationHelper.cs
new file mode 100644 (file)
index 0000000..b495712
--- /dev/null
@@ -0,0 +1,122 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+
+namespace WebServer
+{
+    public static class AuthenticationHelper
+    {
+        public static bool HandleAuthentication(HttpContext context)
+        {
+            string authType = context.Request.QueryString["auth"];
+            string user = context.Request.QueryString["user"];
+            string password = context.Request.QueryString["password"];
+            string domain = context.Request.QueryString["domain"];
+
+            if (string.Equals("basic", authType, StringComparison.OrdinalIgnoreCase))
+            {
+                if (!HandleBasicAuthentication(context, user, password, domain))
+                {
+                    context.Response.End();
+                    return false;
+                }
+            }
+            else if (string.Equals("Negotiate", authType, StringComparison.OrdinalIgnoreCase) ||
+                string.Equals("NTLM", authType, StringComparison.OrdinalIgnoreCase))
+            {
+                if (!HandleChallengeResponseAuthentication(context, authType, user, password, domain))
+                {
+                    context.Response.End();
+                    return false;
+                }
+            }
+            else if (authType != null)
+            {
+                context.Response.StatusCode = 501;
+                context.Response.StatusDescription = "Unsupported auth type: " + authType;
+                context.Response.End();
+                return false;
+            }
+
+            return true;
+        }
+
+        private static bool HandleBasicAuthentication(HttpContext context, string user, string password, string domain)
+        {
+            const string WwwAuthenticateHeaderValue = "Basic realm=\"corefx-networking\"";
+
+            string authHeader = context.Request.Headers["Authorization"];
+            if (authHeader == null)
+            {
+                context.Response.StatusCode = 401;
+                context.Response.Headers.Add("WWW-Authenticate", WwwAuthenticateHeaderValue);
+                return false;
+            }
+
+            string[] split = authHeader.Split(new Char[] { ' ' });
+            if (split.Length < 2)
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = "Invalid Authorization header: " + authHeader;
+                return false;
+            }
+
+            if (!string.Equals("basic", split[0], StringComparison.OrdinalIgnoreCase))
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = "Unsupported auth type: " + split[0];
+                return false;
+            }
+
+            // Decode base64 username:password.
+            byte[] bytes = Convert.FromBase64String(split[1]);
+            string credential = Encoding.ASCII.GetString(bytes);
+            string[] pair = credential.Split(new Char[] { ':' });
+
+            // Prefix "domain\" to username if domain is specified.
+            if (domain != null)
+            {
+                user = domain + "\\" + user;
+            }
+
+            if (pair.Length != 2 || pair[0] != user || pair[1] != password)
+            {
+                context.Response.StatusCode = 401;
+                context.Response.Headers.Add("WWW-Authenticate", WwwAuthenticateHeaderValue);
+                return false;
+            }
+
+            // Success.
+            return true;
+        }
+        private static bool HandleChallengeResponseAuthentication(
+            HttpContext context,
+            string authType,
+            string user,
+            string password,
+            string domain)
+        {
+            string authHeader = context.Request.Headers["Authorization"];
+            if (authHeader == null)
+            {
+                context.Response.StatusCode = 401;
+                context.Response.Headers.Add("WWW-Authenticate", authType);
+                return false;
+            }
+
+            // We don't fully support this authentication method.
+            context.Response.StatusCode = 501;
+            context.Response.StatusDescription = string.Format(
+                "Attempt to use unsupported challenge/response auth type. {0}: {1}",
+                authType,
+                authHeader);
+            return false;
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/ContentHelper.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/ContentHelper.cs
new file mode 100644 (file)
index 0000000..f175428
--- /dev/null
@@ -0,0 +1,54 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.IO;
+using System.IO.Compression;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace WebServer
+{
+    public static class ContentHelper
+    {
+        public static byte[] GetDeflateBytes(string data)
+        {
+            byte[] bytes = Encoding.UTF8.GetBytes(data);
+            var compressedStream = new MemoryStream();
+
+            using (var compressor = new DeflateStream(compressedStream, CompressionMode.Compress, true))
+            {
+                compressor.Write(bytes, 0, bytes.Length);
+            }
+
+            return compressedStream.ToArray();
+        }
+
+        public static byte[] GetGZipBytes(string data)
+        {
+            byte[] bytes = Encoding.UTF8.GetBytes(data);
+            var compressedStream = new MemoryStream();
+
+            using (var compressor = new GZipStream(compressedStream, CompressionMode.Compress, true))
+            {
+                compressor.Write(bytes, 0, bytes.Length);
+            }
+
+            return compressedStream.ToArray();
+        }
+
+        public static byte[] ComputeMD5Hash(string data)
+        {
+            return ComputeMD5Hash(Encoding.UTF8.GetBytes(data));
+        }
+
+        public static byte[] ComputeMD5Hash(byte[] data)
+        {
+            using (MD5 md5 = MD5.Create())
+            {
+                return md5.ComputeHash(data);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx
new file mode 100644 (file)
index 0000000..2a039a0
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="Deflate.ashx.cs" Class="WebServer.Deflate" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Deflate.ashx.cs
new file mode 100644 (file)
index 0000000..889241a
--- /dev/null
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Web;
+
+namespace WebServer
+{
+    /// <summary>
+    /// Summary description for Deflate
+    /// </summary>
+    public class Deflate : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            string responseBody = "Sending DEFLATE compressed";
+
+            context.Response.Headers.Add("Content-MD5", Convert.ToBase64String(ContentHelper.ComputeMD5Hash(responseBody)));
+            context.Response.Headers.Add("Content-Encoding", "deflate");
+
+            context.Response.ContentType = "text/plain";
+
+            byte[] bytes = ContentHelper.GetDeflateBytes(responseBody);
+            context.Response.BinaryWrite(bytes);
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return true;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx
new file mode 100644 (file)
index 0000000..05b6037
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="Echo.ashx.cs" Class="WebServer.Echo" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Echo.ashx.cs
new file mode 100644 (file)
index 0000000..d029666
--- /dev/null
@@ -0,0 +1,54 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Security.Cryptography;
+using System.Text;
+using System.Web;
+
+namespace WebServer
+{
+    public class Echo : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            RequestHelper.AddResponseCookies(context);
+
+            if (!AuthenticationHelper.HandleAuthentication(context))
+            {
+                context.Response.End();
+                return;
+            }
+
+            // Add original request method verb as a custom response header.
+            context.Response.Headers.Add("X-HttpRequest-Method", context.Request.HttpMethod);
+
+            // Echo back JSON encoded payload.
+            RequestInformation info = RequestInformation.Create(context.Request);
+            string echoJson = info.SerializeToJson();
+
+            // Compute MD5 hash to clients can verify the received data.
+            using (MD5 md5 = MD5.Create())
+            {
+                byte[] bytes = Encoding.UTF8.GetBytes(echoJson);
+                byte[] hash = md5.ComputeHash(bytes);
+                string encodedHash = Convert.ToBase64String(hash);
+
+                context.Response.Headers.Add("Content-MD5", encodedHash);
+                context.Response.ContentType = "application/json";
+                context.Response.Write(echoJson);
+            }
+
+            context.Response.End();
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return true;
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx
new file mode 100644 (file)
index 0000000..a647c9a
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="EmptyContent.ashx.cs" Class="WebServer.EmptyContent" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/EmptyContent.ashx.cs
new file mode 100644 (file)
index 0000000..fae32f6
--- /dev/null
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebServer
+{
+    /// <summary>
+    /// Summary description for EmptyContent
+    /// </summary>
+    public class EmptyContent : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            // By default, this empty method sends back a 200 status code with 'Content-Length: 0' response header.
+            // There are no other entity-body related (i.e. 'Content-Type') headers returned.
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return true;
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx
new file mode 100644 (file)
index 0000000..b6ee5e1
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="GZip.ashx.cs" Class="WebServer.GZip" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/GZip.ashx.cs
new file mode 100644 (file)
index 0000000..157d2f4
--- /dev/null
@@ -0,0 +1,36 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Web;
+
+namespace WebServer
+{
+    /// <summary>
+    /// Summary description for Gzip
+    /// </summary>
+    public class GZip : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            string responseBody = "Sending GZIP compressed";
+
+            context.Response.Headers.Add("Content-MD5", Convert.ToBase64String(ContentHelper.ComputeMD5Hash(responseBody)));
+            context.Response.Headers.Add("Content-Encoding", "gzip");
+
+            context.Response.ContentType = "text/plain";
+
+            byte[] bytes = ContentHelper.GetGZipBytes(responseBody);
+            context.Response.BinaryWrite(bytes);
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return false;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/NameValueCollectionConverter.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/NameValueCollectionConverter.cs
new file mode 100644 (file)
index 0000000..98c70e2
--- /dev/null
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Specialized;
+
+using Newtonsoft.Json;
+
+namespace WebServer
+{
+    public class NameValueCollectionConverter : JsonConverter
+    {
+        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+        {
+            var collection = value as NameValueCollection;
+            if (collection == null)
+            {
+                return;
+            }
+
+            writer.Formatting = Formatting.Indented;
+            writer.WriteStartObject();
+            foreach (var key in collection.AllKeys)
+            {
+                writer.WritePropertyName(key);
+                writer.WriteValue(collection.Get(key));
+            }
+            writer.WriteEndObject();
+        }
+
+        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+        {
+            var nameValueCollection = new NameValueCollection();
+            var key = "";
+            while (reader.Read())
+            {
+                if (reader.TokenType == JsonToken.StartObject)
+                {
+                    nameValueCollection = new NameValueCollection();
+                }
+                if (reader.TokenType == JsonToken.EndObject)
+                {
+                    return nameValueCollection;
+                }
+                if (reader.TokenType == JsonToken.PropertyName)
+                {
+                    key = reader.Value.ToString();
+                }
+                if (reader.TokenType == JsonToken.String)
+                    nameValueCollection.Add(key, reader.Value.ToString());
+            }
+            return nameValueCollection;
+        }
+
+        public override bool CanConvert(Type objectType)
+        {
+            return IsTypeDerivedFromType(objectType, typeof(NameValueCollection));
+        }
+
+        private bool IsTypeDerivedFromType(Type childType, Type parentType)
+        {
+            Type testType = childType;
+            while (testType != null)
+            {
+                if (testType == parentType)
+                {
+                    return true;
+                }
+
+                testType = testType.BaseType;
+            }
+
+            return false;
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/AssemblyInfo.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..7affb0b
--- /dev/null
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("WebServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("WebServer")]
+[assembly: AssemblyCopyright("Copyright \u00A9  2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("6acff710-5f63-4e46-b0da-0d1fe36ef4a7")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_CHK.pubxml b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_CHK.pubxml
new file mode 100644 (file)
index 0000000..8850922
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+This file is used by the publish/package process of your Web project. You can customize the behavior of this process
+by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
+-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
+    <SiteUrlToLaunchAfterPublish />
+    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
+    <ExcludeApp_Data>False</ExcludeApp_Data>
+    <publishUrl>.\PublishToIIS</publishUrl>
+    <DeleteExistingFiles>False</DeleteExistingFiles>
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_RET.pubxml b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Properties/PublishProfiles/IIS_PublishToLocalPath_RET.pubxml
new file mode 100644 (file)
index 0000000..15494e5
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+This file is used by the publish/package process of your Web project. You can customize the behavior of this process
+by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
+-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
+    <SiteUrlToLaunchAfterPublish />
+    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
+    <ExcludeApp_Data>False</ExcludeApp_Data>
+    <publishUrl>.\PublishToIIS</publishUrl>
+    <DeleteExistingFiles>False</DeleteExistingFiles>
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx
new file mode 100644 (file)
index 0000000..819e88e
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="Redirect.ashx.cs" Class="WebServer.Redirect" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Redirect.ashx.cs
new file mode 100644 (file)
index 0000000..e1e0554
--- /dev/null
@@ -0,0 +1,89 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Web;
+
+namespace WebServer
+{
+    /// <summary>
+    /// Summary description for Redirect
+    /// </summary>
+    public class Redirect : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            int statusCode = 302;
+            string statusCodeString = context.Request.QueryString["statuscode"];
+            if (!string.IsNullOrEmpty(statusCodeString))
+            {
+                try
+                {
+                    statusCode = int.Parse(statusCodeString);
+                    if (statusCode < 300 || statusCode > 307)
+                    {
+                        context.Response.StatusCode = 500;
+                        context.Response.StatusDescription = "Invalid redirect statuscode: " + statusCodeString;
+                        return;
+                    }
+                }
+                catch (Exception)
+                {
+                    context.Response.StatusCode = 500;
+                    context.Response.StatusDescription = "Error parsing statuscode: " + statusCodeString;
+                    return;
+                }
+            }
+
+            string redirectUri = context.Request.QueryString["uri"];
+            if (string.IsNullOrEmpty(redirectUri))
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = "Missing redirection uri";
+                return;
+            }
+
+            string hopsString = context.Request.QueryString["hops"];
+            int hops = 1;
+            if (!string.IsNullOrEmpty(hopsString))
+            {
+                try
+                {
+                    hops = int.Parse(hopsString);
+                }
+                catch (Exception)
+                {
+                    context.Response.StatusCode = 500;
+                    context.Response.StatusDescription = "Error parsing hops: " + hopsString;
+                    return;
+                }
+            }
+
+            RequestHelper.AddResponseCookies(context);
+
+            if (hops <= 1)
+            {
+                context.Response.Headers.Add("Location", redirectUri);
+            }
+            else
+            {
+                context.Response.Headers.Add(
+                    "Location",
+                    string.Format("/Redirect.ashx?uri={0}&hops={1}",
+                    redirectUri,
+                    hops - 1));
+            }
+
+            context.Response.StatusCode = statusCode;
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return true;
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestHelper.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestHelper.cs
new file mode 100644 (file)
index 0000000..a470212
--- /dev/null
@@ -0,0 +1,44 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Net;
+using System.Web;
+
+namespace WebServer
+{
+    public static class RequestHelper
+    {
+        public static void AddResponseCookies(HttpContext context)
+        {
+            // Turn all 'X-SetCookie' request headers into 'Set-Cookie' response headers.
+            string headerName;
+            string headerValue;
+            for (int i = 0; i < context.Request.Headers.Count; i++)
+            {
+                headerName = context.Request.Headers.Keys[i];
+                headerValue = context.Request.Headers[i];
+
+                if (string.Equals(headerName, "X-SetCookie", StringComparison.OrdinalIgnoreCase))
+                {
+                    context.Response.Headers.Add("Set-Cookie", headerValue);
+                }
+            }
+        }
+
+        public static CookieCollection GetRequestCookies(HttpRequest request)
+        {
+            var cookieCollection = new CookieCollection();
+            HttpCookieCollection cookies = request.Cookies;
+
+            for (int i = 0; i < cookies.Count; i++)
+            {
+                var cookie = new Cookie(cookies[i].Name, cookies[i].Value);
+                cookieCollection.Add(cookie);
+            }
+
+            return cookieCollection;
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestInformation.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/RequestInformation.cs
new file mode 100644 (file)
index 0000000..b923bef
--- /dev/null
@@ -0,0 +1,87 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Specialized;
+using System.IO;
+using System.Net;
+using System.Web;
+
+using Newtonsoft.Json;
+
+namespace WebServer
+{
+    public class RequestInformation
+    {
+        public string Method { get; private set; }
+
+        public string Url { get; private set; }
+
+        public NameValueCollection Headers { get; private set; }
+
+        public NameValueCollection Cookies { get; private set; }
+
+        public string BodyContent { get; private set; }
+
+        public int BodyLength { get; private set; }
+
+        public bool SecureConnection { get; private set; }
+
+        public bool ClientCertificatePresent { get; private set; }
+
+        public HttpClientCertificate ClientCertificate { get; private set; }
+
+        public static RequestInformation Create(HttpRequest request)
+        {
+            var info = new RequestInformation();
+            info.Method = request.HttpMethod;
+            info.Url = request.RawUrl;
+            info.Headers = request.Headers;
+
+            var cookies = new NameValueCollection();
+            CookieCollection cookieCollection = RequestHelper.GetRequestCookies(request);
+            foreach (Cookie cookie in cookieCollection)
+            {
+                cookies.Add(cookie.Name, cookie.Value);
+            }
+            info.Cookies = cookies;
+
+            Stream stream = request.GetBufferedInputStream();
+            using (var reader = new StreamReader(stream))
+            {
+                string body = reader.ReadToEnd();
+                info.BodyContent = body;
+                info.BodyLength = body.Length;
+            }
+
+            info.SecureConnection = request.IsSecureConnection;
+
+            var cs = request.ClientCertificate;
+            info.ClientCertificatePresent = cs.IsPresent;
+            if (cs.IsPresent)
+            {
+                info.ClientCertificate = request.ClientCertificate;
+            }
+
+            return info;
+        }
+
+        public static RequestInformation DeSerializeFromJson(string json)
+        {
+            return (RequestInformation)JsonConvert.DeserializeObject(
+                json,
+                typeof(RequestInformation),
+                new NameValueCollectionConverter());
+        }
+
+        public string SerializeToJson()
+        {
+            return JsonConvert.SerializeObject(this, new NameValueCollectionConverter());
+        }
+
+        private RequestInformation()
+        {
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx
new file mode 100644 (file)
index 0000000..ea27244
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="StatusCode.ashx.cs" Class="WebServer.StatusCode" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/StatusCode.ashx.cs
new file mode 100644 (file)
index 0000000..e491755
--- /dev/null
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Web;
+
+namespace WebServer
+{
+    public class StatusCode : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            string statusCodeString = context.Request.QueryString["statuscode"];
+            string statusDescription = context.Request.QueryString["statusdescription"];
+            try
+            {
+                int statusCode = int.Parse(statusCodeString);
+                context.Response.StatusCode = statusCode;
+                if (statusDescription != null)
+                {
+                    context.Response.StatusDescription = statusDescription;
+                }
+            }
+            catch (Exception)
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = "Error parsing statuscode: " + statusCodeString;
+            }
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return true;
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx
new file mode 100644 (file)
index 0000000..07bfc94
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="Test.ashx.cs" Class="WebServer.Test" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Test.ashx.cs
new file mode 100644 (file)
index 0000000..a26c34b
--- /dev/null
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Net;
+using System.Net.Http;
+using System.Security.Cryptography;
+using System.Text;
+using System.Web;
+
+using Newtonsoft.Json;
+
+namespace WebServer
+{
+    public class Test : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            RequestInformation info = RequestInformation.Create(context.Request);
+
+            string echoJson = info.SerializeToJson();
+
+            // Compute MD5 hash to clients can verify the received data.
+            MD5 md5 = MD5.Create();
+            byte[] bytes = Encoding.ASCII.GetBytes(echoJson);
+            var hash = md5.ComputeHash(bytes);
+            string encodedHash = Convert.ToBase64String(hash);
+            context.Response.Headers.Add("Content-MD5", encodedHash);
+
+            RequestInformation newEcho = RequestInformation.DeSerializeFromJson(echoJson);
+            context.Response.ContentType = "text/plain"; //"application/json";
+            context.Response.Write(echoJson);
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return false;
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx
new file mode 100644 (file)
index 0000000..c50104d
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="VerifyUpload.ashx.cs" Class="WebServer.VerifyUpload" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/VerifyUpload.ashx.cs
new file mode 100644 (file)
index 0000000..5d9f507
--- /dev/null
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Web;
+
+namespace WebServer
+{
+    public class VerifyUpload : IHttpHandler
+    {
+        public void ProcessRequest(HttpContext context)
+        {
+            // Report back original request method verb.
+            context.Response.Headers.Add("X-HttpRequest-Method", context.Request.HttpMethod);
+
+            // Report back original entity-body related request headers.
+            string contentLength = context.Request.Headers["Content-Length"];
+            if (!string.IsNullOrEmpty(contentLength))
+            {
+                context.Response.Headers.Add("X-HttpRequest-Headers-ContentLength", contentLength);
+            }
+
+            string transferEncoding = context.Request.Headers["Transfer-Encoding"];
+            if (!string.IsNullOrEmpty(transferEncoding))
+            {
+                context.Response.Headers.Add("X-HttpRequest-Headers-TransferEncoding", transferEncoding);
+            }
+
+            // Get expected MD5 hash of request body.
+            string expectedHash = context.Request.Headers["Content-MD5"];
+            if (string.IsNullOrEmpty(expectedHash))
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = "Missing 'Content-MD5' request header";
+                return;
+            }
+
+            // Compute MD5 hash of received request body.
+            string actualHash;
+            using (MD5 md5 = MD5.Create())
+            {
+                byte[] hash = md5.ComputeHash(ReadAllRequestBytes(context));
+                actualHash = Convert.ToBase64String(hash);
+            }
+
+            if (expectedHash == actualHash)
+            {
+                context.Response.StatusCode = 200;
+            }
+            else
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = "Request body not verfied";
+            }
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+        private static byte[] ReadAllRequestBytes(HttpContext context)
+        {
+            Stream requestStream = context.Request.GetBufferedInputStream();
+            byte[] buffer = new byte[16 * 1024];
+            using (MemoryStream ms = new MemoryStream())
+            {
+                int read;
+                while ((read = requestStream.Read(buffer, 0, buffer.Length)) > 0)
+                {
+                    ms.Write(buffer, 0, read);
+                }
+                return ms.ToArray();
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Debug.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Debug.config
new file mode 100644 (file)
index 0000000..2e302f9
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
+
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
+  <!--
+    In the example below, the "SetAttributes" transform will change the value of 
+    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
+    finds an attribute "name" that has a value of "MyDB".
+    
+    <connectionStrings>
+      <add name="MyDB" 
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
+    </connectionStrings>
+  -->
+  <system.web>
+    <!--
+      In the example below, the "Replace" transform will replace the entire 
+      <customErrors> section of your web.config file.
+      Note that because there is only one customErrors section under the 
+      <system.web> node, there is no need to use the "xdt:Locator" attribute.
+      
+      <customErrors defaultRedirect="GenericError.htm"
+        mode="RemoteOnly" xdt:Transform="Replace">
+        <error statusCode="500" redirect="InternalError.htm"/>
+      </customErrors>
+    -->
+  </system.web>
+</configuration>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Release.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.Release.config
new file mode 100644 (file)
index 0000000..c358444
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
+
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
+  <!--
+    In the example below, the "SetAttributes" transform will change the value of 
+    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator 
+    finds an attribute "name" that has a value of "MyDB".
+    
+    <connectionStrings>
+      <add name="MyDB" 
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" 
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
+    </connectionStrings>
+  -->
+  <system.web>
+    <compilation xdt:Transform="RemoveAttributes(debug)" />
+    <!--
+      In the example below, the "Replace" transform will replace the entire 
+      <customErrors> section of your web.config file.
+      Note that because there is only one customErrors section under the 
+      <system.web> node, there is no need to use the "xdt:Locator" attribute.
+      
+      <customErrors defaultRedirect="GenericError.htm"
+        mode="RemoteOnly" xdt:Transform="Replace">
+        <error statusCode="500" redirect="InternalError.htm"/>
+      </customErrors>
+    -->
+  </system.web>
+</configuration>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/Web.config
new file mode 100644 (file)
index 0000000..1474319
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+  For more information on how to configure your ASP.NET application, please visit
+  http://go.microsoft.com/fwlink/?LinkId=169433
+  -->
+<configuration>
+  <system.diagnostics>
+    <trace>
+      <listeners>
+        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
+          name="AzureDiagnostics">
+          <filter type="" />
+        </add>
+      </listeners>
+    </trace>
+  </system.diagnostics>
+  <!--
+    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
+
+    The following attributes can be set on the <httpRuntime> tag.
+      <system.Web>
+        <httpRuntime targetFramework="4.5.1" />
+      </system.Web>
+  -->
+  <system.web>
+    <compilation debug="true" targetFramework="4.5.1"/>
+    <httpRuntime targetFramework="4.5.1"/>
+  </system.web>
+  <system.webServer>
+    <security>
+      <requestFiltering>
+        <verbs allowUnlisted="true" />
+      </requestFiltering>
+    </security>
+    <validation validateIntegratedModeConfiguration="false" />
+    <modules runAllManagedModulesForAllRequests="true">
+      <remove name="FileAuthorization" />
+      <remove name="WebDAVModule" />
+    </modules>
+    <handlers accessPolicy="Read, Write, Execute, Script">
+      <remove name="SimpleHandlerFactory-Integrated-4.0" />
+      <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="*" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
+    </handlers>
+    <security>
+      <authorization>
+        <remove users="*" roles="" verbs="" />
+        <add accessType="Allow" users="*" verbs="*" />
+      </authorization>
+    </security>    
+  </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.0.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.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
+    </compilers>
+  </system.codedom>
+  <appSettings>
+    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
+  </appSettings>
+</configuration>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebRole.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebRole.cs
new file mode 100644 (file)
index 0000000..6d41a09
--- /dev/null
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.WindowsAzure;
+using Microsoft.WindowsAzure.Diagnostics;
+using Microsoft.WindowsAzure.ServiceRuntime;
+
+namespace WebServer
+{
+    public class WebRole : RoleEntryPoint
+    {
+        public override bool OnStart()
+        {
+            // For information on handling configuration changes
+            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
+
+            return base.OnStart();
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebServer.csproj b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebServer.csproj
new file mode 100644 (file)
index 0000000..d8f66c7
--- /dev/null
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
+  <Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>
+    </ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{6ACFF710-5F63-4E46-B0DA-0D1FE36EF4A7}</ProjectGuid>
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>WebServer</RootNamespace>
+    <AssemblyName>WebServer</AssemblyName>
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
+    <UseIISExpress>true</UseIISExpress>
+    <IISExpressSSLPort />
+    <IISExpressAnonymousAuthentication />
+    <IISExpressWindowsAuthentication />
+    <IISExpressUseClassicPipelineMode />
+    <UseGlobalApplicationHostFile />
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="Microsoft.Data.Edm, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Data.Edm.5.6.2\lib\net40\Microsoft.Data.Edm.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.Data.OData, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Data.OData.5.6.2\lib\net40\Microsoft.Data.OData.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.Data.Services.Client, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Data.Services.Client.5.6.2\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=2.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\WindowsAzure.Storage.4.3.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Spatial, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Spatial.5.6.2\lib\net40\System.Spatial.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Web.DynamicData" />
+    <Reference Include="System.Web.Entity" />
+    <Reference Include="System.Web.ApplicationServices" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.EnterpriseServices" />
+    <Reference Include="System.Xml.Linq" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="index.html" />
+    <Content Include="packages.config" />
+    <Content Include="WebSocket\Default.htm" />
+    <Content Include="Deflate.ashx" />
+    <Content Include="Echo.ashx" />
+    <Content Include="EmptyContent.ashx" />
+    <Content Include="GZip.ashx" />
+    <Content Include="Redirect.ashx" />
+    <Content Include="StatusCode.ashx" />
+    <Content Include="Test.ashx" />
+    <Content Include="VerifyUpload.ashx" />
+    <None Include="Properties\PublishProfiles\IIS_PublishToLocalPath_CHK.pubxml" />
+    <None Include="Properties\PublishProfiles\IIS_PublishToLocalPath_RET.pubxml" />
+    <None Include="Web.Debug.config">
+      <DependentUpon>Web.config</DependentUpon>
+    </None>
+    <None Include="Web.Release.config">
+      <DependentUpon>Web.config</DependentUpon>
+    </None>
+    <Content Include="WebSocket\EchoWebSocket.ashx" />
+    <Content Include="WebSocket\EchoWebSocketHeaders.ashx" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="Web.config">
+      <SubType>Designer</SubType>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AuthenticationHelper.cs" />
+    <Compile Include="ContentHelper.cs" />
+    <Compile Include="Deflate.ashx.cs">
+      <DependentUpon>Deflate.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="Echo.ashx.cs">
+      <DependentUpon>Echo.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="EmptyContent.ashx.cs">
+      <DependentUpon>EmptyContent.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="GZip.ashx.cs">
+      <DependentUpon>GZip.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="NameValueCollectionConverter.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Redirect.ashx.cs">
+      <DependentUpon>Redirect.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="RequestHelper.cs" />
+    <Compile Include="RequestInformation.cs" />
+    <Compile Include="StatusCode.ashx.cs">
+      <DependentUpon>StatusCode.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="Test.ashx.cs">
+      <DependentUpon>Test.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="VerifyUpload.ashx.cs">
+      <DependentUpon>VerifyUpload.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="WebRole.cs" />
+    <Compile Include="WebSocket\EchoWebSocket.ashx.cs">
+      <DependentUpon>EchoWebSocket.ashx</DependentUpon>
+    </Compile>
+    <Compile Include="WebSocket\EchoWebSocketHeaders.ashx.cs">
+      <DependentUpon>EchoWebSocketHeaders.ashx</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <PropertyGroup>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+  </PropertyGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
+  <ProjectExtensions>
+    <VisualStudio>
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+        <WebProjectProperties>
+          <UseIIS>True</UseIIS>
+          <AutoAssignPort>True</AutoAssignPort>
+          <DevelopmentServerPort>42127</DevelopmentServerPort>
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
+          <IISUrl>http://localhost:42127/</IISUrl>
+          <NTLMAuthentication>False</NTLMAuthentication>
+          <UseCustomServer>False</UseCustomServer>
+          <CustomServerUrl>
+          </CustomServerUrl>
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+        </WebProjectProperties>
+      </FlavorProperties>
+    </VisualStudio>
+  </ProjectExtensions>
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
+    <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
+  </Target>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/Default.htm b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/Default.htm
new file mode 100644 (file)
index 0000000..105c4b5
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+<head>
+    <meta http-equiv="refresh" content="5; url=http://websocket.org/echo.html" />
+</head>
+<body>
+    <h3>Redirecting to the websocket.org test client in 5 seconds...</h3>
+    
+    <p>Use the following URIs to test the local endpoint:</p>
+    <pre>
+    ws://testserver.contoso.com/WebSocket/EchoWebSocket.ashx
+    wss://testserver.contoso.com/WebSocket/EchoWebSocket.ashx
+    </pre>
+</body>
+</html>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx
new file mode 100644 (file)
index 0000000..411704b
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="EchoWebSocket.ashx.cs" Class="WebServer.EchoWebSocket" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx.cs
new file mode 100644 (file)
index 0000000..815778b
--- /dev/null
@@ -0,0 +1,165 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Net.WebSockets;
+using System.Web;
+using System.Web.WebSockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace WebServer
+{
+    public class EchoWebSocket : IHttpHandler
+    {
+        private const int MaxBufferSize = 128 * 1024;
+
+        public void ProcessRequest(HttpContext context)
+        {
+            string subProtocol = context.Request.QueryString["subprotocol"];
+
+            if (context.Request.Url.Query == "?delay10sec")
+            {
+                Thread.Sleep(10000);
+            }
+
+            try
+            {
+                if (!context.IsWebSocketRequest)
+                {
+                    context.Response.StatusCode = 200;
+                    context.Response.ContentType = "text/plain";
+                    context.Response.Write("Not a websocket request");
+
+                    return;
+                }
+
+                if (!string.IsNullOrEmpty(subProtocol))
+                {
+                    var wsOptions = new AspNetWebSocketOptions();
+                    wsOptions.SubProtocol = subProtocol;
+
+                    context.AcceptWebSocketRequest(ProcessWebSocketRequest, wsOptions);
+                }
+                else
+                {
+                    context.AcceptWebSocketRequest(ProcessWebSocketRequest);
+                }
+            }
+            catch (Exception ex)
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = ex.Message;
+            }
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return false;
+            }
+        }
+
+        private async Task ProcessWebSocketRequest(WebSocketContext wsContext)
+        {
+            WebSocket socket = wsContext.WebSocket;
+            var receiveBuffer = new byte[MaxBufferSize];
+            var throwAwayBuffer = new byte[MaxBufferSize];
+
+            // Stay in loop while websocket is open
+            while (socket.State == WebSocketState.Open || socket.State == WebSocketState.CloseSent)
+            {
+                var receiveResult = await socket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None);
+                if (receiveResult.MessageType == WebSocketMessageType.Close)
+                {
+                    if (receiveResult.CloseStatus == WebSocketCloseStatus.Empty)
+                    {
+                        await socket.CloseAsync(WebSocketCloseStatus.Empty, null, CancellationToken.None);
+                    }
+                    else
+                    {
+                        await socket.CloseAsync(
+                            receiveResult.CloseStatus.GetValueOrDefault(),
+                            receiveResult.CloseStatusDescription,
+                            CancellationToken.None);
+                    }
+
+                    continue;
+                }
+
+                // Keep reading until we get an entire message.
+                int offset = receiveResult.Count;
+                while (receiveResult.EndOfMessage == false)
+                {
+                    if (offset < MaxBufferSize)
+                    {
+                        receiveResult = await socket.ReceiveAsync(
+                            new ArraySegment<byte>(receiveBuffer, offset, MaxBufferSize - offset),
+                            CancellationToken.None);
+                    }
+                    else
+                    {
+                        receiveResult = await socket.ReceiveAsync(
+                            new ArraySegment<byte>(throwAwayBuffer),
+                            CancellationToken.None);
+                    }
+
+                    offset += receiveResult.Count;
+                }
+
+                // Close socket if the message was too big.
+                if (offset > MaxBufferSize)
+                {
+                    await socket.CloseAsync(
+                        WebSocketCloseStatus.MessageTooBig,
+                        String.Format("{0}: {1} > {2}", WebSocketCloseStatus.MessageTooBig.ToString(), offset, MaxBufferSize),
+                        CancellationToken.None);
+
+                    continue;
+                }
+
+                bool sendMessage = false;
+                if (receiveResult.MessageType == WebSocketMessageType.Text)
+                {
+                    string receivedMessage = Encoding.UTF8.GetString(receiveBuffer, 0, offset);
+                    if (receivedMessage == ".close")
+                    {
+                        await socket.CloseAsync(WebSocketCloseStatus.NormalClosure, receivedMessage, CancellationToken.None);
+                    }
+                    if (receivedMessage == ".shutdown")
+                    {
+                        await socket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, receivedMessage, CancellationToken.None);
+                    }
+                    else if (receivedMessage == ".abort")
+                    {
+                        socket.Abort();
+                    }
+                    else if (receivedMessage == ".delay5sec")
+                    {
+                        await Task.Delay(5000);
+                    }
+                    else if (socket.State == WebSocketState.Open)
+                    {
+                        sendMessage = true;
+                    }
+                }
+                else
+                {
+                    sendMessage = true;
+                }
+
+                if (sendMessage)
+                {
+                    await socket.SendAsync(
+                            new ArraySegment<byte>(receiveBuffer, 0, offset),
+                            receiveResult.MessageType,
+                            true,
+                            CancellationToken.None);
+                }
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx
new file mode 100644 (file)
index 0000000..72e742e
--- /dev/null
@@ -0,0 +1 @@
+<%@ WebHandler Language="C#" CodeBehind="EchoWebSocketHeaders.ashx.cs" Class="WebServer.EchoWebSocketHeaders" %>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx.cs b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocketHeaders.ashx.cs
new file mode 100644 (file)
index 0000000..af86d73
--- /dev/null
@@ -0,0 +1,90 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Web;
+using System.Net.WebSockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace WebServer
+{
+    public class EchoWebSocketHeaders : IHttpHandler
+    {
+        private const int MaxBufferSize = 1024;
+
+        public void ProcessRequest(HttpContext context)
+        {
+            try
+            {
+                if (!context.IsWebSocketRequest)
+                {
+                    context.Response.StatusCode = 200;
+                    context.Response.ContentType = "text/plain";
+                    context.Response.Write("Not a websocket request");
+
+                    return;
+                }
+
+                context.AcceptWebSocketRequest(ProcessWebSocketRequest);
+            }
+            catch (Exception ex)
+            {
+                context.Response.StatusCode = 500;
+                context.Response.StatusDescription = ex.Message;
+            }
+        }
+
+        public bool IsReusable
+        {
+            get
+            {
+                return false;
+            }
+        }
+
+        private async Task ProcessWebSocketRequest(WebSocketContext wsContext)
+        {
+            WebSocket socket = wsContext.WebSocket;
+            var receiveBuffer = new byte[MaxBufferSize];
+
+            // Reflect all headers and cookies
+            var sb = new StringBuilder();
+            sb.AppendLine("Headers:");
+
+            foreach (string header in wsContext.Headers.AllKeys)
+            {
+                sb.Append(header);
+                sb.Append(":");
+                sb.AppendLine(wsContext.Headers[header]);
+            }
+
+            byte[] sendBuffer = Encoding.UTF8.GetBytes(sb.ToString());
+            await socket.SendAsync(new ArraySegment<byte>(sendBuffer), WebSocketMessageType.Text, true, new CancellationToken());
+
+            // Stay in loop while websocket is open
+            while (socket.State == WebSocketState.Open || socket.State == WebSocketState.CloseSent)
+            {
+                var receiveResult = await socket.ReceiveAsync(new ArraySegment<byte>(receiveBuffer), CancellationToken.None);
+                if (receiveResult.MessageType == WebSocketMessageType.Close)
+                {
+                    if (receiveResult.CloseStatus == WebSocketCloseStatus.Empty)
+                    {
+                        await socket.CloseAsync(WebSocketCloseStatus.Empty, null, CancellationToken.None);
+                    }
+                    else
+                    {
+                        await socket.CloseAsync(
+                            receiveResult.CloseStatus.GetValueOrDefault(),
+                            receiveResult.CloseStatusDescription,
+                            CancellationToken.None);
+                    }
+
+                    continue;
+                }
+            }
+        }
+    }
+}
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/index.html b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/index.html
new file mode 100644 (file)
index 0000000..6deebf9
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Networking Test Server</title>
+       <meta charset="utf-8" />
+</head>
+<body>
+    <h1>NetworkingTestServer</h1>
+    <p>Networking test server in Azure. Used by dotnet/corefx repo.</p>
+</body>
+</html>
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/packages.config b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/packages.config
new file mode 100644 (file)
index 0000000..9ca0fb1
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
+  <package id="Microsoft.Data.Edm" version="5.6.2" targetFramework="net452" />
+  <package id="Microsoft.Data.OData" version="5.6.2" targetFramework="net452" />
+  <package id="Microsoft.Data.Services.Client" version="5.6.2" targetFramework="net452" />
+  <package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
+  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net452" />
+  <package id="Newtonsoft.Json" version="5.0.8" targetFramework="net452" />
+  <package id="System.Spatial" version="5.6.2" targetFramework="net452" />
+  <package id="WindowsAzure.Storage" version="4.3.0" targetFramework="net452" />
+</packages>
\ No newline at end of file
diff --git a/src/libraries/Common/tests/System/Net/Prerequisites/Servers/buildAndPackage.ps1 b/src/libraries/Common/tests/System/Net/Prerequisites/Servers/buildAndPackage.ps1
new file mode 100644 (file)
index 0000000..e987a3a
--- /dev/null
@@ -0,0 +1,33 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+# Requires Visual Studio Command Prompt
+# Requires Azure SDK and .Net Framework SDK installed on the build machine.
+
+$cdir = pwd
+$folderName = "CoreFxNetCloudService"
+$src = Join-Path $cdir $folderName
+$tmp = Join-Path $Env:TEMP $folderName
+$tmpOut = Join-Path $tmp "WebServer\PublishToIIS"
+$dst = Join-Path $cdir "..\Deployment\IISApplications"
+
+$nugetSrc = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
+
+if (Test-Path $tmp)
+{
+    rm -Recurse $tmp
+}
+
+copy -Recurse $src $Env:TEMP
+Start-BitsTransfer -Source $nugetSrc -Destination $tmp
+
+cd $tmp
+
+.\nuget restore
+msbuild /p:DeployOnBuild=true /p:PublishProfile=IIS_PublishToLocalPath_RET
+
+copy -Recurse $tmpOut $dst
+
+cd $cdir
+rm -Recurse $tmp
index 4a058ab..72a3ccc 100644 (file)
@@ -16,28 +16,31 @@ namespace System.Net.Http.Functional.Tests
     {
         private static string DomainJoinedTestServer => Configuration.Http.DomainJoinedHttpHost;
         private static bool DomainJoinedTestsEnabled => !string.IsNullOrEmpty(DomainJoinedTestServer);
-        private static string SpecificUserName = "test";
-        private static string SpecificPassword = "Password1";
-        private static string SpecificDomain = DomainJoinedTestServer;
-        private static Uri AuthenticatedServer =
+        private static bool DomainProxyTestsEnabled => (!string.IsNullOrEmpty(Configuration.Http.DomainJoinedProxyHost)) && DomainJoinedTestsEnabled;
+
+        private static string s_specificUserName = Configuration.Security.ActiveDirectoryUserName;
+        private static string s_specificPassword = Configuration.Security.ActiveDirectoryUserPassword;
+        private static string s_specificDomain = Configuration.Security.ActiveDirectoryName;
+        private static Uri s_authenticatedServer =
             new Uri($"http://{DomainJoinedTestServer}/test/auth/negotiate/showidentity.ashx");
             
         // This test endpoint offers multiple schemes, Basic and NTLM, in that specific order. This endpoint
         // helps test that the client will use the stronger of the server proposed auth schemes and
         // not the first auth scheme.
-        private static Uri MultipleSchemesAuthenticatedServer =
+        private static Uri s_multipleSchemesAuthenticatedServer =
             new Uri($"http://{DomainJoinedTestServer}/test/auth/multipleschemes/showidentity.ashx");
 
         private readonly ITestOutputHelper _output;
         private readonly NetworkCredential _specificCredential =
-            new NetworkCredential(SpecificUserName, SpecificPassword, SpecificDomain);
+            new NetworkCredential(s_specificUserName, s_specificPassword, s_specificDomain);
 
         public DefaultCredentialsTest(ITestOutputHelper output)
         {
             _output = output;
-            _output.WriteLine(AuthenticatedServer.ToString());
+            _output.WriteLine(s_authenticatedServer.ToString());
         }
 
+        [ActiveIssue(10041)]
         [ConditionalTheory(nameof(DomainJoinedTestsEnabled))]
         [InlineData(false)]
         [InlineData(true)]
@@ -47,12 +50,13 @@ namespace System.Net.Http.Functional.Tests
             handler.UseProxy = useProxy;
 
             using (var client = new HttpClient(handler))
-            using (HttpResponseMessage response = await client.GetAsync(AuthenticatedServer))
+            using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer))
             {
                 Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
             }
         }
 
+        [ActiveIssue(10041)]
         [ConditionalTheory(nameof(DomainJoinedTestsEnabled))]
         [InlineData(false)]
         [InlineData(true)]
@@ -61,12 +65,13 @@ namespace System.Net.Http.Functional.Tests
             var handler = new HttpClientHandler { UseProxy = useProxy, UseDefaultCredentials = false };
 
             using (var client = new HttpClient(handler))
-            using (HttpResponseMessage response = await client.GetAsync(AuthenticatedServer))
+            using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer))
             {
                 Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
             }
         }
 
+        [ActiveIssue(10041)]
         [ConditionalTheory(nameof(DomainJoinedTestsEnabled))]
         [InlineData(false)]
         [InlineData(true)]
@@ -75,7 +80,7 @@ namespace System.Net.Http.Functional.Tests
             var handler = new HttpClientHandler { UseProxy = useProxy, UseDefaultCredentials = true };
 
             using (var client = new HttpClient(handler))
-            using (HttpResponseMessage response = await client.GetAsync(AuthenticatedServer))
+            using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer))
             {
                 Assert.Equal(HttpStatusCode.OK, response.StatusCode);
 
@@ -86,6 +91,7 @@ namespace System.Net.Http.Functional.Tests
             }
         }
 
+        [ActiveIssue(10041)]
         [ConditionalTheory(nameof(DomainJoinedTestsEnabled))]
         [InlineData(false)]
         [InlineData(true)]
@@ -94,7 +100,7 @@ namespace System.Net.Http.Functional.Tests
             var handler = new HttpClientHandler { UseProxy = useProxy, UseDefaultCredentials = true };
 
             using (var client = new HttpClient(handler))
-            using (HttpResponseMessage response = await client.GetAsync(MultipleSchemesAuthenticatedServer))
+            using (HttpResponseMessage response = await client.GetAsync(s_multipleSchemesAuthenticatedServer))
             {
                 Assert.Equal(HttpStatusCode.OK, response.StatusCode);
 
@@ -105,6 +111,7 @@ namespace System.Net.Http.Functional.Tests
             }
         }
 
+        [ActiveIssue(10041)]
         [ConditionalTheory(nameof(DomainJoinedTestsEnabled))]
         [InlineData(false)]
         [InlineData(true)]
@@ -116,15 +123,16 @@ namespace System.Net.Http.Functional.Tests
                 Credentials = _specificCredential };
 
             using (var client = new HttpClient(handler))
-            using (HttpResponseMessage response = await client.GetAsync(AuthenticatedServer))
+            using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer))
             {
                 Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                 
                 string responseBody = await response.Content.ReadAsStringAsync();
-                VerifyAuthentication(responseBody, true, SpecificDomain + "\\" + SpecificUserName);
+                VerifyAuthentication(responseBody, true, s_specificDomain + "\\" + s_specificUserName);
             }
         }
 
+        [ActiveIssue(10041)]
         [ConditionalTheory(nameof(DomainJoinedTestsEnabled))]
         [InlineData(false)]
         [InlineData(true)]
@@ -138,7 +146,7 @@ namespace System.Net.Http.Functional.Tests
             };
 
             using (var client = new HttpClient(handler))
-            using (HttpResponseMessage response = await client.GetAsync(AuthenticatedServer))
+            using (HttpResponseMessage response = await client.GetAsync(s_authenticatedServer))
             {
                 Assert.Equal(HttpStatusCode.OK, response.StatusCode);
 
@@ -149,7 +157,8 @@ namespace System.Net.Http.Functional.Tests
             }
         }
 
-        [ConditionalFact(nameof(DomainJoinedTestsEnabled))]
+        [ActiveIssue(10041)]
+        [ConditionalFact(nameof(DomainProxyTestsEnabled))]
         public async Task Proxy_UseAuthenticatedProxyWithNoCredentials_ProxyAuthenticationRequired()
         {
             var handler = new HttpClientHandler();
@@ -162,7 +171,8 @@ namespace System.Net.Http.Functional.Tests
             }
         }
 
-        [ConditionalFact(nameof(DomainJoinedTestsEnabled))]
+        [ActiveIssue(10041)]
+        [ConditionalFact(nameof(DomainProxyTestsEnabled))]
         public async Task Proxy_UseAuthenticatedProxyWithDefaultCredentials_OK()
         {
             var handler = new HttpClientHandler();
@@ -174,8 +184,8 @@ namespace System.Net.Http.Functional.Tests
                 Assert.Equal(HttpStatusCode.OK, response.StatusCode);
             }
         }
-
-        [ConditionalFact(nameof(DomainJoinedTestsEnabled))]
+        
+        [ConditionalFact(nameof(DomainProxyTestsEnabled))]
         public async Task Proxy_UseAuthenticatedProxyWithWrappedDefaultCredentials_OK()
         {
             ICredentials wrappedCreds = new CredentialWrapper
@@ -235,13 +245,13 @@ namespace System.Net.Http.Functional.Tests
                 _credentials = credentials;
 
                 string host = Configuration.Http.DomainJoinedProxyHost;
-                Assert.False(string.IsNullOrEmpty(host), "TestSettings.Http.DomainJoinedProxyHost must specify proxy hostname");
+                Assert.False(string.IsNullOrEmpty(host), "DomainJoinedProxyHost must specify proxy hostname");
 
                 string portString = Configuration.Http.DomainJoinedProxyPort;
-                Assert.False(string.IsNullOrEmpty(portString), "TestSettings.Http.DomainJoinedProxyPort must specify proxy port number");
+                Assert.False(string.IsNullOrEmpty(portString), "DomainJoinedProxyPort must specify proxy port number");
 
                 int port;
-                Assert.True(int.TryParse(portString, out port), "TestSettings.Http.DomainJoinedProxyPort must be a valid port number");
+                Assert.True(int.TryParse(portString, out port), "DomainJoinedProxyPort must be a valid port number");
 
                 _proxyUri = new Uri(string.Format("http://{0}:{1}", host, port));
             }
index 9fb3261..469be17 100644 (file)
@@ -57,6 +57,9 @@
     <Compile Include="$(CommonTestPath)\System\Net\Configuration.Http.cs">
       <Link>Common\System\Net\Configuration.Http.cs</Link>
     </Compile>
+    <Compile Include="$(CommonTestPath)\System\Net\Configuration.Security.cs">
+      <Link>Common\System\Net\Configuration.Security.cs</Link>
+    </Compile>
     <Compile Include="$(CommonTestPath)\System\Net\TestWebProxies.cs">
       <Link>Common\System\Net\TestWebProxies.cs</Link>
     </Compile>