Skip to content

Commit

Permalink
update service code
Browse files Browse the repository at this point in the history
  • Loading branch information
afifi-ins committed Sep 11, 2024
1 parent 874a0d0 commit bae0e73
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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.

#if NET

using CoreWCF;
using CoreWCF.Channels;

namespace WcfService
{
//public enum BasicHttpsSecurityMode
//{
// //
// // Summary:
// // The Transport security mode.
// Transport,
// //
// // Summary:
// // The TransportWithMessageCredential security mode.
// TransportWithMessageCredential
//}

// Cast BasicHttpsSecurityMode (WCF) to BasicHttpSecurityMode (CoreWCF)
//internal enum BasicHttpsSecurityMode
//{
// None,
// Transport,
// Message,
// TransportWithMessageCredential,
// TransportCredentialOnly
//}

internal class NetHttpsBinding : NetHttpBinding
{
public NetHttpsBinding() : base((BasicHttpSecurityMode)BasicHttpsSecurityMode.Transport)
{
}

public NetHttpsBinding(BasicHttpsSecurityMode securityMode) : base((BasicHttpSecurityMode)securityMode)
{
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ protected override IList<Binding> GetBindings()
{
var bindings = new List<Binding>();
bindings.Add(GetNetTcpBinding());

#if !NET
if (!HostingEnvironment.IsHosted)
{
bindings.Add(GetNetNamedPipeBinding());
}

#endif
return bindings;
}

Expand All @@ -35,10 +37,12 @@ private Binding GetNetTcpBinding()
return new NetTcpBinding() { Name = "tcp-default" };
}

#if !NET
private Binding GetNetNamedPipeBinding()
{
return new NetNamedPipeBinding() { Name = "namedpipe-default" };
}
#endif

public TcpDefaultResourceTestServiceHost(params Uri[] baseAddresses)
: base(typeof(WcfService), baseAddresses)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ protected override IList<Binding> GetBindings()
{
var bindings = new List<Binding>();
bindings.Add(GetNetTcpBinding());

#if !NET
if (!HostingEnvironment.IsHosted)
{
bindings.Add(GetNetNamedPipeBinding());
}

#endif
return bindings;
}

Expand All @@ -35,10 +37,12 @@ private Binding GetNetTcpBinding()
return new NetTcpBinding(SecurityMode.None) { Name = "tcp-nosecurity" };
}

#if !NET
private Binding GetNetNamedPipeBinding()
{
return new NetNamedPipeBinding(NetNamedPipeSecurityMode.None) { Name = "namedpipe-nosecurity" };
}
#endif

public TcpNoSecurityTestServiceHost(params Uri[] baseAddresses)
: base(typeof(WcfService), baseAddresses)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#if NET
using CoreWCF;
#else
#if !NET
using System;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
#endif

namespace WcfService
{
Expand All @@ -31,3 +28,4 @@ public TestHostWebServiceHost(Type serviceType, params Uri[] baseAddresses)
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
<IsPackable>false</IsPackable>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
</PropertyGroup>

<ItemGroup>
<Using Include="System.Runtime.Serialization" />
<Using Include="Microsoft.Extensions.DependencyInjection.Extensions" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreWCF.Http" Version="1.5.0-wsrs.1.g14d7d00798" />
<PackageReference Include="CoreWCF.NetTcp" Version="1.5.0-wsrs.1.g14d7d00798" />
<PackageReference Include="CoreWCF.Primitives" Version="1.5.0-wsrs.1.g14d7d00798" />
<PackageReference Include="CoreWCF.WebHttp" Version="1.5.0-wsrs.1.g14d7d00798" />
<PackageReference Include="idunno.Authentication.Basic" Version="2.3.1" />
<PackageReference Include="CoreWCF.Http" Version="1.6" />
<PackageReference Include="CoreWCF.NetTcp" Version="1.6" />
<PackageReference Include="CoreWCF.Primitives" Version="1.6" />
<PackageReference Include="CoreWCF.WebHttp" Version="1.6" />
<PackageReference Include="idunno.Authentication.Basic" Version="2.4.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\IISHostedWcfService\**\*.cs">
Expand All @@ -24,52 +24,29 @@
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Remove="..\IISHostedWcfService\App_code\ISessionTests.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\IVerifyWebSockets.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\SessionTestsService.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\DuplexTestServiceHosts.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\Federation\AcceptAnyUsernameSecurityTokenHandler.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\Federation\FederationSTSServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\Federation\ReturnX509SubjectNameOrRSAIssuerNameRegistry.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\Federation\SelfHostSecurityTokenService.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\HttpsClientCertificateTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsCertTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsUsernameTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\NetHttpsTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\NetHttpTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\ReliableSessionDuplexTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\ReliableSessionOneWayTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\ReliableSessionTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\Saml2IssuedTokenTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\TcpDefaultResourceTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\TcpNoSecurityTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\TcpSessionTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsCertTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsUsernameTestServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\TestHostWebServiceHost.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\testhosts\WebSocketTestServiceHosts.cs" />
<Compile Remove="..\IISHostedWcfService\App_code\VerifyWebSockets.cs" />
<None Include="..\IISHostedWcfService\App_code\ISessionTests.cs" />
<None Include="..\IISHostedWcfService\App_code\IVerifyWebSockets.cs" />
<None Include="..\IISHostedWcfService\App_code\SessionTestsService.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\DuplexTestServiceHosts.cs" />

<None Include="..\IISHostedWcfService\App_code\testhosts\Federation\AcceptAnyUsernameSecurityTokenHandler.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\Federation\FederationSTSServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\Federation\ReturnX509SubjectNameOrRSAIssuerNameRegistry.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\Federation\SelfHostSecurityTokenService.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\HttpsClientCertificateTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsCertTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsUsernameTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\NetHttpsTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\NetHttpTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\ReliableSessionDuplexTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\ReliableSessionOneWayTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\ReliableSessionTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\Saml2IssuedTokenTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\TcpDefaultResourceTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\TcpNoSecurityTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\TcpSessionTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsCertTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\HttpsTransportSecurityMessageCredentialsUsernameTestServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\TestHostWebServiceHost.cs" />
<None Include="..\IISHostedWcfService\App_code\testhosts\WebSocketTestServiceHosts.cs" />
<None Include="..\IISHostedWcfService\App_code\VerifyWebSockets.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\IISHostedWcfService\Web.config">
Expand Down

0 comments on commit bae0e73

Please sign in to comment.