diff --git a/eng/SendToHelix.proj b/eng/SendToHelix.proj
index a0798288c159..3244bf343b48 100644
--- a/eng/SendToHelix.proj
+++ b/eng/SendToHelix.proj
@@ -24,74 +24,75 @@
-
-
-
-
+
+
+
-
-
- $(XUnitPublishTargetFramework)
-
-
- $(XUnitPublishTargetFramework)
-
-
+
+
+ $(XUnitPublishTargetFramework)
+
+
+ $(XUnitPublishTargetFramework)
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
- true
- $(BUILD_SOURCEVERSIONAUTHOR)
- anon
-
+
+ true
+ $(BUILD_SOURCEVERSIONAUTHOR)
+ anon
+
-
-
- $(HelixPreCommands);dir C:\ /s /b /o:gn | find "SelfHostedCoreWCFService"
- $(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\Release\net6.0\SelfHostedCoreWCFService bootstrap:true
- $(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net6.0\SelfHostedCoreWCFService bootstrap:true
-
-
-
- $(HelixPreCommands);find / -type d -name 'SelfHostedCoreWCFService'
- $(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh
- $(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt
- $(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/Release/net6.0/SelfHostedCoreWCFService bootstrap:true
- $(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net6.0/SelfHostedCoreWCFService bootstrap:true
-
-
+
+ $(HelixPreCommands);dir C:\ /s /b /o:gn | find "SelfHostedCoreWCFService"
+ $(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\Release\net6.0\SelfHostedCoreWCFService bootstrap:true
+ $(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net6.0\SelfHostedCoreWCFService bootstrap:true
+
+
+
+ $(HelixPreCommands);find / -type d -name 'SelfHostedCoreWCFService'
+ $(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh
+ $(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt
+ $(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/Release/net6.0/SelfHostedCoreWCFService bootstrap:true
+ $(HelixPreCommands);$HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net6.0/SelfHostedCoreWCFService bootstrap:true
+
+
+
-
+
@@ -103,7 +104,7 @@
- SelfHostedCoreWCFService
+ %(Identity)
diff --git a/global.json b/global.json
index ad72d0db90e6..9db1660cc323 100644
--- a/global.json
+++ b/global.json
@@ -4,7 +4,7 @@
"runtimes": {
"aspnetcore": [
"3.1.5",
- "6.0.15",
+ "6.0.30",
"7.0.4",
"8.0.0"
]
diff --git a/src/System.Private.ServiceModel/tools/IISHostedWcfService/App_code/TestDefinitionHelper.cs b/src/System.Private.ServiceModel/tools/IISHostedWcfService/App_code/TestDefinitionHelper.cs
index 4953315fe91f..c79ecc6d8f85 100644
--- a/src/System.Private.ServiceModel/tools/IISHostedWcfService/App_code/TestDefinitionHelper.cs
+++ b/src/System.Private.ServiceModel/tools/IISHostedWcfService/App_code/TestDefinitionHelper.cs
@@ -3,7 +3,11 @@
// See the LICENSE file in the project root for more information.
#if NET
+using System.Diagnostics;
+using System.Linq;
+using System.Net;
using System.Security.Claims;
+using System.Security.Cryptography.X509Certificates;
using CoreWCF.Configuration;
using CoreWCF.Description;
using idunno.Authentication.Basic;
@@ -26,7 +30,7 @@ internal class TestDefinitionHelper
private const int DefaultWebSocketPort = 8083;
private const int DefaultWebSocketSPort = 8084;
- private static IDictionary BaseAddresses
+ internal static IDictionary BaseAddresses
{
get
{
@@ -57,10 +61,47 @@ private static IDictionary BaseAddresses
}
#if NET
+ internal class ServiceTestHostOptions
+ {
+ public List serviceBaseAddresses = new List();
+ public Dictionary endpointBasePath = new Dictionary();
+ }
+
internal static async Task StartHosts()
{
bool success = true;
- var webHost = WebHost.CreateDefaultBuilder()
+ var serviceTestHostOptionsDict = new Dictionary();
+
+ var webHost = new WebHostBuilder()
+ .UseKestrel(options => {
+ options.Listen(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.HTTP]).Port);
+ options.Listen(address: IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.HTTPS]).Port, listenOptions =>
+ {
+ listenOptions.UseHttps(httpsOptions =>
+ {
+ X509Certificate2 cert = TestHost.CertificateFromFriendlyName(StoreName.My, StoreLocation.LocalMachine, "WCF Bridge - Machine certificate generated by the CertificateManager");
+ httpsOptions.ServerCertificate = cert;
+ });
+ if (Debugger.IsAttached)
+ {
+ listenOptions.UseConnectionLogging();
+ }
+ });
+ options.Listen(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.WS]).Port);
+ options.Listen(address: IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.WSS]).Port, listenOptions =>
+ {
+ listenOptions.UseHttps(httpsOptions =>
+ {
+ X509Certificate2 cert = TestHost.CertificateFromFriendlyName(StoreName.My, StoreLocation.LocalMachine, "WCF Bridge - Machine certificate generated by the CertificateManager");
+ httpsOptions.ServerCertificate = cert;
+ });
+ if (Debugger.IsAttached)
+ {
+ listenOptions.UseConnectionLogging();
+ }
+ });
+ })
+ .UseNetTcp(IPAddress.IPv6Any, new Uri(BaseAddresses[ServiceSchema.NETTCP]).Port)
.ConfigureServices(services =>
{
services.AddAuthentication(BasicAuthenticationDefaults.AuthenticationScheme)
@@ -100,8 +141,7 @@ internal static async Task StartHosts()
{
foreach (var serviceTestHost in GetAttributedServiceHostTypes())
{
- var serviceBaseAddresses = new List();
- var endpointBasePath = new Dictionary();
+ var serviceTestHostOptions = new ServiceTestHostOptions();
foreach (TestServiceDefinitionAttribute attr in serviceTestHost.GetCustomAttributes(typeof(TestServiceDefinitionAttribute), false))
{
Uri serviceBaseAddress = null;
@@ -111,9 +151,9 @@ internal static async Task StartHosts()
{
if (attr.Schema.HasFlag(schema))
{
- endpointBasePath.Add(schema, attr.BasePath);
+ serviceTestHostOptions.endpointBasePath.Add(schema, attr.BasePath);
serviceBaseAddress = new Uri(BaseAddresses[(ServiceSchema)schema]);
- serviceBaseAddresses.Add(serviceBaseAddress);
+ serviceTestHostOptions.serviceBaseAddresses.Add(serviceBaseAddress);
}
}
}
@@ -132,30 +172,37 @@ internal static async Task StartHosts()
}
}
+ serviceTestHostOptionsDict.Add(serviceTestHost.Name, serviceTestHostOptions);
try
{
if (success)
{
- var serviceHost = (ServiceHost)Activator.CreateInstance(serviceTestHost, serviceBaseAddresses.ToArray());
+ string serviceHostTypeName = serviceTestHost.Name;
+ var serviceHost = (ServiceHost)Activator.CreateInstance(serviceTestHost, serviceTestHostOptionsDict[serviceHostTypeName].serviceBaseAddresses.ToArray());
serviceBuilder.AddService(serviceHost.ServiceType, options =>
{
- foreach (var baseAddress in serviceBaseAddresses)
+ var localHostTypeName = serviceHostTypeName;
+ //options.BaseAddresses.Clear();
+ foreach (var baseAddress in serviceTestHostOptionsDict[localHostTypeName].serviceBaseAddresses)
{
if (!options.BaseAddresses.Contains(baseAddress))
options.BaseAddresses.Add(baseAddress);
}
+
+ foreach (var endpoint in serviceHost.Endpoints)
+ {
+ Enum schema = ServiceHostHelper.ToServiceSchema(endpoint.Binding.Scheme);
+ string basePath = serviceTestHostOptionsDict[localHostTypeName].endpointBasePath[schema];
+ string endpointAddress = string.Format("{0}/{1}", basePath, endpoint.Address);
+ serviceBuilder.AddServiceEndpoint(serviceHost.ServiceType, endpoint.ContractType, endpoint.Binding, new Uri(endpointAddress, UriKind.RelativeOrAbsolute), null);
+ }
});
- foreach (var endpoint in serviceHost.Endpoints)
- {
- Enum schema = ServiceHostHelper.ToServiceSchema(endpoint.Binding.Scheme);
- string basePath = endpointBasePath[schema];
- string endpointAddress = string.Format("{0}/{1}", basePath, endpoint.Address);
- serviceBuilder.AddServiceEndpoint(serviceHost.ServiceType, endpoint.ContractType, endpoint.Binding, new Uri(endpointAddress, UriKind.RelativeOrAbsolute), null);
- }
+
serviceBuilder.ConfigureServiceHostBase(serviceHost.ServiceType, serviceHostBase =>
{
+ var localHostTypeName = serviceHostTypeName;
var smb = serviceHostBase.Description.Behaviors.Find();
- if (serviceBaseAddresses.Where(uri => uri.Scheme == Uri.UriSchemeHttps).Any())
+ if (serviceTestHostOptionsDict[localHostTypeName].serviceBaseAddresses.Where(uri => uri.Scheme == Uri.UriSchemeHttps).Any())
{
smb.HttpsGetEnabled = true;
}
diff --git a/src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs b/src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs
index 4f726929c53d..8cd264e65cbb 100644
--- a/src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs
+++ b/src/System.Private.ServiceModel/tools/SelfHostedCoreWcfService/Program.cs
@@ -30,8 +30,8 @@ public static async Task Main(string[] args)
TimeSpan validatePeriod = TimeSpan.FromDays(1);
string crlFileLocation = "c:\\WCFTest\\test.crl";
- CertificateGeneratorLibrary.SetupCerts(testserverbase, validatePeriod, crlFileLocation);
-
+ //CertificateGeneratorLibrary.SetupCerts(testserverbase, validatePeriod, crlFileLocation);
+ //System.Diagnostics.Debugger.Launch();
Console.WriteLine("Starting services...");
await TestDefinitionHelper.StartHosts();