From 3c9039b3d9e5ec8718b949489d2db66981f87eb1 Mon Sep 17 00:00:00 2001 From: Abdelwahab Afifi Date: Tue, 31 Oct 2023 20:10:47 +0200 Subject: [PATCH] Update WCF sample Compression Encoder code to conditionally support .NET framework / Core --- .../Compression/CS/Client/Client.csproj | 117 ++++-------------- .../ConnectedService.json | 17 +++ .../Reference.cs | 72 +++++++++++ .../Compression/CS/Client/Program.cs | 9 ++ .../CS/Client/Properties/AssemblyInfo.cs | 23 ---- .../Compression/CS/Client/app.config | 2 +- .../CS/GZipEncoder/GZipEncoder.csproj | 95 +++----------- .../GZipEncoder/GZipMessageEncoderFactory.cs | 51 +++----- .../GZipMessageEncodingBindingElement.cs | 57 ++++----- ...ipMessageEncodingBindingElementImporter.cs | 3 +- .../CS/GZipEncoder/Properties/AssemblyInfo.cs | 23 ---- .../Compression/CS/Server/Server.csproj | 53 ++------ .../Compression/CS/Server/app.config | 15 ++- 13 files changed, 201 insertions(+), 336 deletions(-) create mode 100644 framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/ConnectedService.json create mode 100644 framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/Reference.cs delete mode 100644 framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Properties/AssemblyInfo.cs delete mode 100644 framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/Properties/AssemblyInfo.cs diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Client.csproj b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Client.csproj index 9aebac1dbcb..8feacdebbe9 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Client.csproj +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Client.csproj @@ -1,99 +1,36 @@ - - + - Debug - AnyCPU - 8.0.50727 - 2.0 - {97E8A065-31ED-4506-B3A4-6B2E2ED5B124} + net462;net6.0 Exe - Properties - Microsoft.Samples.GZipEncoder - Client - v4.0 - - - 2.0 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - + Client + GZipEncoder + Microsoft Corporation + Windows Communication Foundation and Windows Workflow Foundation SDK + Copyright (c) Microsoft Corporation - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - - - - + + + + + - - - - + + + + + - - + + + - - - {3EB736C4-62EA-4887-B040-948B13EF29B9} - GZipEncoder - + + + + + - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Microsoft Visual Basic PowerPacks 10.0 - true - - - False - Windows Installer 3.1 - true - + - - \ No newline at end of file + diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/ConnectedService.json b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/ConnectedService.json new file mode 100644 index 00000000000..34a34d95d1e --- /dev/null +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/ConnectedService.json @@ -0,0 +1,17 @@ +{ + "ExtendedData": { + "inputs": [ + "http://localhost:8000/samples/GZipEncoder?wsdl" + ], + "collectionTypes": [ + "System.Array", + "System.Collections.Generic.Dictionary`2" + ], + "namespaceMappings": [ + "*, Microsoft.Samples.GZipEncoder" + ], + "sync": true, + "targetFramework": "net6.0", + "typeReuseMode": "None" + } +} \ No newline at end of file diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/Reference.cs b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/Reference.cs new file mode 100644 index 00000000000..c93b24094db --- /dev/null +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Connected Services/Microsoft.Samples.GZipEncoder/Reference.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Samples.GZipEncoder +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="Microsoft.Samples.GZipEncoder.ISampleServer")] + public interface ISampleServer + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISampleServer/Echo", ReplyAction="http://tempuri.org/ISampleServer/EchoResponse")] + string Echo(string input); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISampleServer/Echo", ReplyAction="http://tempuri.org/ISampleServer/EchoResponse")] + System.Threading.Tasks.Task EchoAsync(string input); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISampleServer/BigEcho", ReplyAction="http://tempuri.org/ISampleServer/BigEchoResponse")] + string[] BigEcho(string[] input); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ISampleServer/BigEcho", ReplyAction="http://tempuri.org/ISampleServer/BigEchoResponse")] + System.Threading.Tasks.Task BigEchoAsync(string[] input); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + public interface ISampleServerChannel : Microsoft.Samples.GZipEncoder.ISampleServer, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.1.0")] + public partial class SampleServerClient : System.ServiceModel.ClientBase, Microsoft.Samples.GZipEncoder.ISampleServer + { + + public SampleServerClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public string Echo(string input) + { + return base.Channel.Echo(input); + } + + public System.Threading.Tasks.Task EchoAsync(string input) + { + return base.Channel.EchoAsync(input); + } + + public string[] BigEcho(string[] input) + { + return base.Channel.BigEcho(input); + } + + public System.Threading.Tasks.Task BigEchoAsync(string[] input) + { + return base.Channel.BigEchoAsync(input); + } + + public virtual System.Threading.Tasks.Task OpenAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); + } + } +} diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Program.cs b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Program.cs index 08e9c9b1b40..025db314ee5 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Program.cs +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Program.cs @@ -3,6 +3,8 @@ //---------------------------------------------------------------- using System; +using System.ServiceModel; +using System.ServiceModel.Channels; namespace Microsoft.Samples.GZipEncoder { @@ -10,7 +12,14 @@ static class Program { static void Main() { +#if NET6_0_OR_GREATER + Binding binding = new CustomBinding(new GZipMessageEncodingBindingElement(), new HttpTransportBindingElement()); + EndpointAddress endpointAddress = new EndpointAddress(new Uri("http://localhost:8000/samples/GZipEncoder")); + SampleServerClient client = new SampleServerClient(binding, endpointAddress); +#else SampleServerClient client = new SampleServerClient(); +#endif + Console.WriteLine("Calling Echo(string):"); Console.WriteLine("Server responds: {0}", client.Echo("Simple hello")); diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Properties/AssemblyInfo.cs b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Properties/AssemblyInfo.cs deleted file mode 100644 index f1e0dd31444..00000000000 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ - -using System; -using System.Reflection; -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: ComVisible(false)] -[assembly: CLSCompliant(true)] -[assembly: AssemblyTitle("Client")] -[assembly: AssemblyDescription("GZipEncoder")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft Corporation")] -[assembly: AssemblyProduct("Windows Communication Foundation and Windows Workflow Foundation SDK")] -[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] \ No newline at end of file diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/app.config b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/app.config index 6b6fb9dd944..e3afbcc87ce 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/app.config +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Client/app.config @@ -24,4 +24,4 @@ - + diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipEncoder.csproj b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipEncoder.csproj index e7ca1af23ef..a53e97c32fd 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipEncoder.csproj +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipEncoder.csproj @@ -1,87 +1,22 @@ - - + - Debug - AnyCPU - 8.0.50727 - 2.0 - {3EB736C4-62EA-4887-B040-948B13EF29B9} + net462;net6.0 Library - Microsoft.Samples.GZipEncoder - GZipEncoder - 4 - v4.0 - - - 2.0 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - + GZipEncoder + GZipEncoder + Microsoft Corporation + Windows Communication Foundation and Windows Workflow Foundation SDK + Copyright (c) Microsoft Corporation - - true - full - false - .\bin\ - DEBUG;TRACE - AllRules.ruleset - - - pdbonly - true - .\bin\Release\ - TRACE - AllRules.ruleset - - - + + - - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Microsoft Visual Basic PowerPacks 10.0 - true - - - False - Windows Installer 3.1 - true - + + + + - - \ No newline at end of file + + diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncoderFactory.cs b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncoderFactory.cs index a96cb643784..1e3fb5fb3d4 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncoderFactory.cs +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncoderFactory.cs @@ -12,7 +12,7 @@ namespace Microsoft.Samples.GZipEncoder //This class is used to create the custom encoder (GZipMessageEncoder) internal class GZipMessageEncoderFactory : MessageEncoderFactory { - MessageEncoder encoder; + private readonly MessageEncoder _encoder; //The GZip encoder wraps an inner encoder //We require a factory to be passed in that will create this inner encoder @@ -20,30 +20,24 @@ public GZipMessageEncoderFactory(MessageEncoderFactory messageEncoderFactory) { if (messageEncoderFactory == null) throw new ArgumentNullException("messageEncoderFactory", "A valid message encoder factory must be passed to the GZipEncoder"); - encoder = new GZipMessageEncoder(messageEncoderFactory.Encoder); + _encoder = new GZipMessageEncoder(messageEncoderFactory.Encoder); } //The service framework uses this property to obtain an encoder from this encoder factory - public override MessageEncoder Encoder - { - get { return encoder; } - } + public override MessageEncoder Encoder => _encoder; - public override MessageVersion MessageVersion - { - get { return encoder.MessageVersion; } - } + public override MessageVersion MessageVersion => _encoder.MessageVersion; //This is the actual GZip encoder - class GZipMessageEncoder : MessageEncoder + private class GZipMessageEncoder : MessageEncoder { - static string GZipContentType = "application/x-gzip"; + private const string GZipContentType = "application/x-gzip"; //This implementation wraps an inner encoder that actually converts a WCF Message //into textual XML, binary XML or some other format. This implementation then compresses the results. //The opposite happens when reading messages. //This member stores this inner encoder. - MessageEncoder innerEncoder; + private readonly MessageEncoder _innerEncoder; //We require an inner encoder to be supplied (see comment above) internal GZipMessageEncoder(MessageEncoder messageEncoder) @@ -51,30 +45,21 @@ internal GZipMessageEncoder(MessageEncoder messageEncoder) { if (messageEncoder == null) throw new ArgumentNullException("messageEncoder", "A valid message encoder must be passed to the GZipEncoder"); - innerEncoder = messageEncoder; + _innerEncoder = messageEncoder; } - public override string ContentType - { - get { return GZipContentType; } - } + public override string ContentType => GZipContentType; - public override string MediaType - { - get { return GZipContentType; } - } + public override string MediaType => GZipContentType; //SOAP version to use - we delegate to the inner encoder for this - public override MessageVersion MessageVersion - { - get { return innerEncoder.MessageVersion; } - } + public override MessageVersion MessageVersion => _innerEncoder.MessageVersion; //Helper method to compress an array of bytes - static ArraySegment CompressBuffer(ArraySegment buffer, BufferManager bufferManager, int messageOffset) + private static ArraySegment CompressBuffer(ArraySegment buffer, BufferManager bufferManager, int messageOffset) { MemoryStream memoryStream = new MemoryStream(); - + using (GZipStream gzStream = new GZipStream(memoryStream, CompressionMode.Compress, true)) { gzStream.Write(buffer.Array, buffer.Offset, buffer.Count); @@ -93,7 +78,7 @@ static ArraySegment CompressBuffer(ArraySegment buffer, BufferManage } //Helper method to decompress an array of bytes - static ArraySegment DecompressBuffer(ArraySegment buffer, BufferManager bufferManager) + private static ArraySegment DecompressBuffer(ArraySegment buffer, BufferManager bufferManager) { MemoryStream memoryStream = new MemoryStream(buffer.Array, buffer.Offset, buffer.Count); MemoryStream decompressedStream = new MemoryStream(); @@ -130,7 +115,7 @@ public override Message ReadMessage(ArraySegment buffer, BufferManager buf //Decompress the buffer ArraySegment decompressedBuffer = DecompressBuffer(buffer, bufferManager); //Use the inner encoder to decode the decompressed buffer - Message returnMessage = innerEncoder.ReadMessage(decompressedBuffer, bufferManager); + Message returnMessage = _innerEncoder.ReadMessage(decompressedBuffer, bufferManager); returnMessage.Properties.Encoder = this; return returnMessage; } @@ -139,7 +124,7 @@ public override Message ReadMessage(ArraySegment buffer, BufferManager buf public override ArraySegment WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset) { //Use the inner encoder to encode a Message into a buffered byte array - ArraySegment buffer = innerEncoder.WriteMessage(message, maxMessageSize, bufferManager, 0); + ArraySegment buffer = _innerEncoder.WriteMessage(message, maxMessageSize, bufferManager, 0); //Compress the resulting byte array return CompressBuffer(buffer, bufferManager, messageOffset); } @@ -150,14 +135,14 @@ public override Message ReadMessage(System.IO.Stream stream, int maxSizeOfHeader //This will ensure that the inner stream gets closed when the message gets closed, which //will ensure that resources are available for reuse/release. GZipStream gzStream = new GZipStream(stream, CompressionMode.Decompress, false); - return innerEncoder.ReadMessage(gzStream, maxSizeOfHeaders); + return _innerEncoder.ReadMessage(gzStream, maxSizeOfHeaders); } public override void WriteMessage(Message message, System.IO.Stream stream) { using (GZipStream gzStream = new GZipStream(stream, CompressionMode.Compress, true)) { - innerEncoder.WriteMessage(message, gzStream); + _innerEncoder.WriteMessage(message, gzStream); } // innerEncoder.WriteMessage(message, gzStream) depends on that it can flush data by flushing diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElement.cs b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElement.cs index 15a17dd5a93..f4c244cba81 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElement.cs +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElement.cs @@ -5,14 +5,13 @@ using System; using System.Configuration; using System.ServiceModel.Channels; -using System.ServiceModel.Configuration; using System.ServiceModel.Description; using System.Xml; namespace Microsoft.Samples.GZipEncoder { // This is constants for GZip message encoding policy. - static class GZipMessageEncodingPolicyConstants + internal static class GZipMessageEncodingPolicyConstants { public const string GZipEncodingName = "GZipEncoding"; public const string GZipEncodingNamespace = "http://schemas.microsoft.com/ws/06/2004/mspolicy/netgzip1"; @@ -20,54 +19,41 @@ static class GZipMessageEncodingPolicyConstants } //This is the binding element that, when plugged into a custom binding, will enable the GZip encoder - public sealed class GZipMessageEncodingBindingElement + public sealed class GZipMessageEncodingBindingElement : MessageEncodingBindingElement //BindingElement +#if NET462_OR_GREATER , IPolicyExportExtension +#endif { - //We will use an inner binding element to store information required for the inner encoder - MessageEncodingBindingElement innerBindingElement; - //By default, use the default text encoder as the inner encoder public GZipMessageEncodingBindingElement() : this(new TextMessageEncodingBindingElement()) { } - public GZipMessageEncodingBindingElement(MessageEncodingBindingElement messageEncoderBindingElement) - { - this.innerBindingElement = messageEncoderBindingElement; - } + public GZipMessageEncodingBindingElement(MessageEncodingBindingElement messageEncoderBindingElement) => InnerMessageEncodingBindingElement = messageEncoderBindingElement; - public MessageEncodingBindingElement InnerMessageEncodingBindingElement - { - get { return innerBindingElement; } - set { innerBindingElement = value; } - } + //We will use an inner binding element to store information required for the inner encoder + public MessageEncodingBindingElement InnerMessageEncodingBindingElement { get; set; } //Main entry point into the encoder binding element. Called by WCF to get the factory that will create the //message encoder - public override MessageEncoderFactory CreateMessageEncoderFactory() - { - return new GZipMessageEncoderFactory(innerBindingElement.CreateMessageEncoderFactory()); - } - + public override MessageEncoderFactory CreateMessageEncoderFactory() => new GZipMessageEncoderFactory(InnerMessageEncodingBindingElement.CreateMessageEncoderFactory()); + public override MessageVersion MessageVersion { - get { return innerBindingElement.MessageVersion; } - set { innerBindingElement.MessageVersion = value; } + get => InnerMessageEncodingBindingElement.MessageVersion; + set => InnerMessageEncodingBindingElement.MessageVersion = value; } - public override BindingElement Clone() - { - return new GZipMessageEncodingBindingElement(this.innerBindingElement); - } + public override BindingElement Clone() => new GZipMessageEncodingBindingElement(this.InnerMessageEncodingBindingElement); public override T GetProperty(BindingContext context) { if (typeof(T) == typeof(XmlDictionaryReaderQuotas)) { - return innerBindingElement.GetProperty(context); + return InnerMessageEncodingBindingElement.GetProperty(context); } - else + else { return base.GetProperty(context); } @@ -82,6 +68,7 @@ public override IChannelFactory BuildChannelFactory(BindingC return context.BuildInnerChannelFactory(); } +#if NET462_OR_GREATER public override IChannelListener BuildChannelListener(BindingContext context) { if (context == null) @@ -112,29 +99,28 @@ void IPolicyExportExtension.ExportPolicy(MetadataExporter exporter, PolicyConver GZipMessageEncodingPolicyConstants.GZipEncodingName, GZipMessageEncodingPolicyConstants.GZipEncodingNamespace)); } +#endif } +#if NET462_OR_GREATER //This class is necessary to be able to plug in the GZip encoder binding element through //a configuration file - public class GZipMessageEncodingElement : BindingElementExtensionElement + public class GZipMessageEncodingElement : System.ServiceModel.Configuration.BindingElementExtensionElement { public GZipMessageEncodingElement() { } //Called by the WCF to discover the type of binding element this config section enables - public override Type BindingElementType - { - get { return typeof(GZipMessageEncodingBindingElement); } - } + public override Type BindingElementType => typeof(GZipMessageEncodingBindingElement); //The only property we need to configure for our binding element is the type of //inner encoder to use. Here, we support text and binary. [ConfigurationProperty("innerMessageEncoding", DefaultValue = "textMessageEncoding")] public string InnerMessageEncoding { - get { return (string)base["innerMessageEncoding"]; } - set { base["innerMessageEncoding"] = value; } + get => (string)base["innerMessageEncoding"]; + set => base["innerMessageEncoding"] = value; } //Called by the WCF to apply the configuration settings (the property above) to the binding element @@ -164,4 +150,5 @@ protected override BindingElement CreateBindingElement() return bindingElement; } } +#endif } diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElementImporter.cs b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElementImporter.cs index d85f166eb64..5296186e9fc 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElementImporter.cs +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/GZipMessageEncodingBindingElementImporter.cs @@ -7,6 +7,7 @@ using System.ServiceModel.Description; using System.Xml; +#if NET462_OR_GREATER namespace Microsoft.Samples.GZipEncoder { public class GZipMessageEncodingBindingElementImporter : IPolicyImportExtension @@ -42,4 +43,4 @@ void IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConver } } } - +#endif diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/Properties/AssemblyInfo.cs b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/Properties/AssemblyInfo.cs deleted file mode 100644 index 631687d2f82..00000000000 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/GZipEncoder/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ - -using System; -using System.Reflection; -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: ComVisible(false)] -[assembly: CLSCompliant(true)] -[assembly: AssemblyTitle("GZipEncoder")] -[assembly: AssemblyDescription("GZipEncoder")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft Corporation")] -[assembly: AssemblyProduct("Windows Communication Foundation and Windows Workflow Foundation SDK")] -[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] \ No newline at end of file diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/Server.csproj b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/Server.csproj index 56480530d08..ddff80555b6 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/Server.csproj +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/Server.csproj @@ -1,36 +1,17 @@  - + + Debug AnyCPU 8.0.50727 - 2.0 {9746FE53-56C5-4ED5-9214-D93F457A0560} Exe Microsoft.Samples.GZipEncoder Server 4 - v4.0 - - - 2.0 - + v4.6.2 publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - true @@ -39,6 +20,7 @@ .\bin\ DEBUG;TRACE AllRules.ruleset + false pdbonly @@ -46,6 +28,7 @@ .\bin\Release\ TRACE AllRules.ruleset + false @@ -66,27 +49,5 @@ GZipEncoder - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Microsoft Visual Basic PowerPacks 10.0 - true - - - False - Windows Installer 3.1 - true - - - - \ No newline at end of file + + diff --git a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/app.config b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/app.config index 83bfb8215ab..9cefe0ef050 100644 --- a/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/app.config +++ b/framework/wcf/Extensibility/MessageEncoder/Compression/CS/Server/app.config @@ -3,20 +3,27 @@ - + - + - + + + + + + + + @@ -28,4 +35,4 @@ - +