diff --git a/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/ClientForm.cs b/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/ClientForm.cs index 80605dd6024..7eb5b831726 100644 --- a/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/ClientForm.cs +++ b/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/ClientForm.cs @@ -15,7 +15,6 @@ using System.Text; using System.Windows.Forms; using System.Windows.Automation; -using System.Windows; using System.Diagnostics; namespace CustomElementClient @@ -990,4 +989,4 @@ private void btnMisc_Click(object sender, EventArgs e) // ps.SubscribePropertyChange(elementButton); } } // end class -} // end namespace \ No newline at end of file +} // end namespace diff --git a/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/CustomElementClient.csproj b/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/CustomElementClient.csproj index 82909458be6..2ed457e6392 100644 --- a/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/CustomElementClient.csproj +++ b/snippets/csharp/System.Windows.Automation/AndCondition/.ctor/CustomElementClient.csproj @@ -1,96 +1,10 @@ - + - Debug - AnyCPU - 10.0.20821 - 2.0 - {1A1AA924-1E92-4BFF-8D76-E71CF639E3B4} WinExe - Properties + net10.0-windows + true + true CustomElementClient CustomElementClient - true - http://localhost/CustomElementClient/ - true - Web - true - Foreground - 7 - Days - false - false - true - 1.0.0.* - true - v4.8 - - - true - full - false - c:\sd_avalon.binaries.x86chk\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - ..\..\..\..\..\sd_avalon.binaries.x86chk\ - TRACE - prompt - 4 - - - - False - ..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v2.0.50215\System.dll - - - - - - - - False - False - - - False - ..\..\..\..\..\sd_avalon.binaries.x86chk\UIAutomationTypes.dll - False - - - False - ..\..\..\..\..\sd_avalon.binaries.x86chk\WindowsBase.dll - False - - - - - Form - - - ClientForm.cs - - - - - ClientForm.cs - Designer - - - - - - False - .NET Framework 2.0 Beta - true - - - - - - \ No newline at end of file diff --git a/snippets/csharp/System.Windows.Automation/AutomationEventArgs/.ctor/ElementProvider.csproj b/snippets/csharp/System.Windows.Automation/AutomationEventArgs/.ctor/ElementProvider.csproj index c7c27994610..636f8aa0692 100644 --- a/snippets/csharp/System.Windows.Automation/AutomationEventArgs/.ctor/ElementProvider.csproj +++ b/snippets/csharp/System.Windows.Automation/AutomationEventArgs/.ctor/ElementProvider.csproj @@ -1,98 +1,14 @@ - + - Debug - AnyCPU - 10.0.20821 - 2.0 - {60A534E9-F891-4B01-9AD4-5EFDFE6B0B42} WinExe - Properties + net10.0-windows ElementProvider ElementProvider - true - http://localhost/ElementProvider/ - true - Web - true - Foreground - 7 - Days - false - false - true - 1.0.0.* - true - LocalIntranet - false - v4.8 - + true + latest - - true - full - false - C:\sd_avalon.binaries.x86chk\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - False - D:\avalon.binaries.x86chk\UIAutomationClient.dll - - - False - - - False - D:\avalon.binaries.x86chk\UIAutomationTypes.dll - - - False - - - - - Component - - - - - - - ProviderForm.cs - - - Form - - - ProviderForm.cs - - - - - False - .NET Framework 2.0 Beta - true - - + - + - \ No newline at end of file diff --git a/snippets/csharp/System.Windows.Documents/Hyperlink/NavigateUri/Readme.txt b/snippets/csharp/System.Windows.Documents/Hyperlink/NavigateUri/Readme.txt deleted file mode 100644 index 7652ec8fb24..00000000000 --- a/snippets/csharp/System.Windows.Documents/Hyperlink/NavigateUri/Readme.txt +++ /dev/null @@ -1,17 +0,0 @@ -.NET Framework 3.0 XAML Browser Application Readme ----------------------------------- -XAML Browser Applications run in a sandbox with "Internet Permissions". -Only those .NET Framework 3.0 features that have been successfully security reviewed and validated as safe by the .NET Framework 3.0 team will run inside the sandbox. - -.NET Framework 3.0 Item Templates - which work in the sandbox? --------------------------------------------------------- -Won't work by design - .NET Framework 3.0 Window - In the internet zone, you don't have the permission to "popup" new windows. - -Debugging XAML Browser Applications - (F5) --------------------------------------------------------- -In order to successfully debug an XAML Browser Application in Visual Studio, you must enable unmanaged code debugging -via the Debug page in the Properties view. Developers using Visual C# and Visual Basic Express do not need to do this. - -The first time that this project is debugged, a dialog may appear stating that there -is no debug information available for PresentationHost.exe. This dialog can be -safely dismissed. diff --git a/snippets/csharp/System.Windows/TextAlignment/Overview/FlowDocumentSnippets.csproj b/snippets/csharp/System.Windows/TextAlignment/Overview/FlowDocumentSnippets.csproj index 5ca64d959b2..78e143feadc 100644 --- a/snippets/csharp/System.Windows/TextAlignment/Overview/FlowDocumentSnippets.csproj +++ b/snippets/csharp/System.Windows/TextAlignment/Overview/FlowDocumentSnippets.csproj @@ -1,109 +1,12 @@ - - + - Debug - AnyCPU + WinExe + net10.0-windows + true FlowDocumentSnippets FlowDocumentSnippets - winexe - - v4.8 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - 10.0.20821 - {CE41D70B-777B-42E0-BEE4-15853D754276} - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - AllRules.ruleset - - - false - true - .\bin\Release\ - TRACE - AllRules.ruleset - - - - - - - - - - 4.0 - - - - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MyApp.xaml - Code - - - Window1.xaml - Code - - - - False - Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Microsoft Visual Basic PowerPacks 10.0 - true - - - False - Windows Installer 3.1 - true - + - - \ No newline at end of file + diff --git a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs index fbcf80734f5..963b08f562f 100644 --- a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs +++ b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs @@ -6,10 +6,9 @@ namespace Microsoft.WCF.Documentation { + // [CallbackBehaviorAttribute( - IncludeExceptionDetailInFaults= true, - UseSynchronizationContext=true, - ValidateMustUnderstand=true + UseSynchronizationContext=true )] public class Client : SampleDuplexHelloCallback { @@ -22,18 +21,19 @@ public Client() public void Run() { - // Picks up configuration from the configuration file. + Binding binding = new CustomBinding(); + EndpointAddress address = new("http://localhost:8080/DuplexHello"); SampleDuplexHelloClient wcfClient - = new SampleDuplexHelloClient(new InstanceContext(this), "WSDualHttpBinding_SampleDuplexHello"); + = new(new InstanceContext(this), binding, address); try { Console.ForegroundColor = ConsoleColor.White; - Console.WriteLine("Enter a greeting to send and press ENTER: "); + Console.WriteLine("Enter a greeting to send and press 'Enter': "); Console.Write(">>> "); Console.ForegroundColor = ConsoleColor.Green; string greeting = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.White; - Console.WriteLine("Called service with: \r\n\t" + greeting); + Console.WriteLine($"Called service with: \r\n\t{greeting}"); wcfClient.Hello(greeting); Console.WriteLine("Execution passes service call and moves to the WaitHandle."); this.waitHandle.WaitOne(); @@ -48,27 +48,28 @@ SampleDuplexHelloClient wcfClient } catch (TimeoutException timeProblem) { - Console.WriteLine("The service operation timed out. " + timeProblem.Message); + Console.WriteLine($"The service operation timed out. {timeProblem.Message}"); Console.ReadLine(); } catch (CommunicationException commProblem) { - Console.WriteLine("There was a communication problem. " + commProblem.Message); + Console.WriteLine($"There was a communication problem. {commProblem.Message}"); Console.ReadLine(); } } public static void Main() { - Client client = new Client(); + Client client = new(); client.Run(); } public void Reply(string response) { Console.WriteLine("Received output."); - Console.WriteLine("\r\n\t" + response); + Console.WriteLine($"\r\n\t{response}"); this.waitHandle.Set(); } } + // } // diff --git a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.csproj b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.csproj index e17be2cd354..32019b52155 100644 --- a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.csproj +++ b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.csproj @@ -1,48 +1,22 @@ - + - Debug - AnyCPU - {66190530-B4E3-4BF0-94B4-DFE52D15E50F} Exe - false + net10.0 Client Microsoft.WCF.Documentation + disable + disable - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - - - pdbonly - true - .\bin\Release\ - TRACE - - - - - - - - - - - - + Always - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/host.csproj b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/host.csproj deleted file mode 100644 index 227ea09ff0d..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/host.csproj +++ /dev/null @@ -1,44 +0,0 @@ - - - Debug - AnyCPU - {907F0C93-0FC2-4419-B0CE-2B775830A3C2} - Exe - false - HostApplication - Microsoft.WCF.Documentation - - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - - - pdbonly - true - .\bin\Release\ - TRACE - - - - - - - - - - - - - - - Always - - - - - - - \ No newline at end of file diff --git a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/hostapplication.cs b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/hostapplication.cs deleted file mode 100644 index 835953b2f2a..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/hostapplication.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Configuration; -using System.Collections.Generic; -using System.ServiceModel; -using System.Text; - -namespace Microsoft.WCF.Documentation -{ - class HostApplication - { - - static void Main() - { - HostApplication app = new HostApplication(); - app.Run(); - } - - private void Run() - { - // Create a ServiceHost for the service type and use the base address from configuration. - using (ServiceHost serviceHost = new ServiceHost(typeof(DuplexHello))) - { - try - { - // Open the ServiceHostBase to create listeners and start listening for messages. - serviceHost.Open(); - - // The service can now be accessed. - Console.WriteLine("The service is ready."); - Console.WriteLine("Press to terminate service."); - Console.WriteLine(); - Console.ReadLine(); - - // Close the ServiceHostBase to shutdown the service. - serviceHost.Close(); - } - catch (TimeoutException timeProblem) - { - Console.WriteLine("The service operation timed out. " + timeProblem.Message); - Console.Read(); - } - catch (CommunicationException commProblem) - { - Console.WriteLine("There was a communication problem. " + commProblem.Message); - Console.Read(); - } - } - } - } -} diff --git a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/hostapplication.exe.config b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/hostapplication.exe.config deleted file mode 100644 index 3b38b7adbe6..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/hostapplication.exe.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/services.cs b/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/services.cs deleted file mode 100644 index cdb2a98e818..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/services.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -using System; -using System.Collections.Generic; -using System.ServiceModel; -using System.Threading; - -namespace Microsoft.WCF.Documentation -{ - [ServiceContract( - Name = "SampleDuplexHello", - Namespace = "http://microsoft.wcf.documentation", - CallbackContract = typeof(IHelloCallbackContract), - SessionMode = SessionMode.Required - )] - public interface IDuplexHello - { - [OperationContract(IsOneWay = true)] - void Hello(string greeting); - } - - public interface IHelloCallbackContract - { - [OperationContract(IsOneWay = true)] - void Reply(string responseToGreeting); - } - - public class DuplexHello : IDuplexHello - { - - public DuplexHello() - { - Console.WriteLine("Service object created: " + this.GetHashCode().ToString()); - } - - ~DuplexHello() - { - Console.WriteLine("Service object destroyed: " + this.GetHashCode().ToString()); - } - - public void Hello(string greeting) - { - Console.WriteLine("Caller sent: " + greeting); - Console.WriteLine("Session ID: " + OperationContext.Current.SessionId); - Console.WriteLine("Waiting two seconds before returning call."); - // Put a slight delay to demonstrate asynchronous behavior on client. - Thread.Sleep(2000); - IHelloCallbackContract callerProxy - = OperationContext.Current.GetCallbackChannel(); - string response = "Service object " + this.GetHashCode().ToString() + " received: " + greeting; - Console.WriteLine("Sending back: " + response); - callerProxy.Reply(response); - } - } -} -// diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs index fc894355651..c66864a2b38 100644 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs +++ b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs @@ -1,9 +1,5 @@ using System; using System.ServiceModel; -using System.ServiceModel.Channels; - -using microsoft.wcf.documentation; -// for the client behavior using Microsoft.WCF.Documentation; // @@ -13,12 +9,13 @@ public static void Main() { try { - // Picks up configuration from the config file. + WSHttpBinding binding = new(SecurityMode.Message); + EndpointAddress address = new("http://localhost:8080/ServiceMetadata/SampleService"); ChannelFactory factory - = new ChannelFactory("WSHttpBinding_ISampleService"); + = new(binding, address); // Add the client side behavior programmatically to all created channels. - factory.Endpoint.Behaviors.Add(new EndpointBehaviorMessageInspector()); + factory.Endpoint.EndpointBehaviors.Add(new EndpointBehaviorMessageInspector()); ISampleServiceChannel wcfClientChannel = factory.CreateChannel(); diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.csproj b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.csproj index 8357f3af5f2..d395bd39096 100644 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.csproj +++ b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.csproj @@ -1,87 +1,24 @@ - + - Debug - AnyCPU - {66190530-B4E3-4BF0-94B4-DFE52D15E50F} Exe - false + net10.0 Client Microsoft.WCF.Documentation - - - - - 3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - - - pdbonly - true - .\bin\Release\ - TRACE + disable + disable + {66190530-B4E3-4BF0-94B4-DFE52D15E50F} - - - - - - - - - - - - - + Always + - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - + + + - - - - - - - - + \ No newline at end of file diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/host.csproj b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/host.csproj deleted file mode 100644 index d8bbde4bae6..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/host.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - Debug - AnyCPU - {907F0C93-0FC2-4419-B0CE-2B775830A3C2} - Exe - false - HostApplication - Microsoft.WCF.Documentation - - - - - 3.5 - - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - - - pdbonly - true - .\bin\Release\ - TRACE - - - - - - - - - - - - - - - - - Always - - - - - - - \ No newline at end of file diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/hostapplication.cs b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/hostapplication.cs deleted file mode 100644 index 1ccef0630d5..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/hostapplication.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Configuration; -using System.Collections.Generic; -using System.ServiceModel; -using System.Text; - -namespace Microsoft.WCF.Documentation -{ - class HostApplication - { - - static void Main() - { - HostApplication app = new HostApplication(); - app.Run(); - } - - private void Run() - { - // Create a ServiceHost for the service type and use the base address from configuration. - using (ServiceHost serviceHost = new ServiceHost(typeof(SampleService))) - { - try - { - // Open the ServiceHostBase to create listeners and start listening for messages. - serviceHost.Open(); - - // The service can now be accessed. - Console.WriteLine("The service is ready."); - Console.WriteLine("Press to terminate service."); - Console.WriteLine(); - Console.ReadLine(); - - // Close the ServiceHostBase to shutdown the service. - serviceHost.Close(); - } - catch (TimeoutException timeProblem) - { - Console.WriteLine("The service operation timed out. " + timeProblem.Message); - Console.Read(); - } - catch (CommunicationException commProblem) - { - Console.WriteLine("There was a communication problem. " + commProblem.Message); - Console.Read(); - } - } - } - } -} diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/hostapplication.exe.config b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/hostapplication.exe.config deleted file mode 100644 index 6e49f0b25df..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/hostapplication.exe.config +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/iendpointbehaviormessageinspector.cs b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/iendpointbehaviormessageinspector.cs index c368d4420f5..5a3cedadf45 100644 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/iendpointbehaviormessageinspector.cs +++ b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/iendpointbehaviormessageinspector.cs @@ -1,82 +1,63 @@  // using System; -using System.Collections.Generic; using System.ServiceModel; -using System.ServiceModel.Configuration; using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; -using System.Text; namespace Microsoft.WCF.Documentation { - class EndpointBehaviorMessageInspector : BehaviorExtensionElement, IEndpointBehavior, IDispatchMessageInspector, IClientMessageInspector - { - // - // IEndpointBehavior Members - public void AddBindingParameters(ServiceEndpoint serviceEndpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) - { - return; - } - - public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior) - { - behavior.MessageInspectors.Add(new EndpointBehaviorMessageInspector()); - } - - public void ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher) - { - endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new EndpointBehaviorMessageInspector()); - } - - public void Validate(ServiceEndpoint serviceEndpoint) - { - return; - } - // - - // - // BehaviorExtensionElement members - public override Type BehaviorType - { - get { return typeof(EndpointBehaviorMessageInspector); } - } - - protected override object CreateBehavior() - { - return new EndpointBehaviorMessageInspector(); + class EndpointBehaviorMessageInspector : IEndpointBehavior, IClientMessageInspector + { + // + // IEndpointBehavior Members + public void AddBindingParameters(ServiceEndpoint serviceEndpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) + { + return; + } + + public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime behavior) + { + behavior.ClientMessageInspectors.Add(new EndpointBehaviorMessageInspector()); + } + + public void ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher) + { + return; + } + + public void Validate(ServiceEndpoint serviceEndpoint) + { + return; + } + // + + // + // Sample helper for creating the behavior instance in modern .NET builds. + public static EndpointBehaviorMessageInspector CreateBehavior() + { + return new EndpointBehaviorMessageInspector(); + } + // + + // + // IClientMessageInspector members + // + + #region IClientMessageInspector Members + + public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState) + { + Console.WriteLine("AfterReceiveReply called."); + } + + public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel) + { + Console.WriteLine("BeforeSendRequest called."); + return null; + } + + #endregion } - // - - // - // IDispatchMessageInspector Members - - public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel, InstanceContext instanceContext) - { - Console.WriteLine("AfterReceiveRequest called."); - return null; - } - - public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState) - { - Console.WriteLine("BeforeSendReply called."); - } - // - - #region IClientMessageInspector Members - - public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState) - { - Console.WriteLine("AfterReceiveReply called."); - } - - public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel) - { - Console.WriteLine("BeforeSendRequest called."); - return null; - } - - #endregion - } } // diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs index 5cdae074f6d..4ea16a9dbf4 100644 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs +++ b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs @@ -8,16 +8,17 @@ // //------------------------------------------------------------------------------ +using Microsoft.WCF.Documentation; + [assembly: System.Runtime.Serialization.ContractNamespaceAttribute("http://microsoft.wcf.documentation", ClrNamespace="microsoft.wcf.documentation")] -namespace microsoft.wcf.documentation +namespace Microsoft.WCF.Documentation { using System.Runtime.Serialization; - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute()] - public partial class SampleFault : object, System.Runtime.Serialization.IExtensibleDataObject + public partial class SampleFault : object, IExtensibleDataObject { private System.Runtime.Serialization.ExtensionDataObject extensionDataField; @@ -51,14 +52,12 @@ public string FaultMessage } } - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation")] public interface ISampleService { - [System.ServiceModel.OperationContractAttribute(Action="http://microsoft.wcf.documentation/ISampleService/SampleMethod", ReplyAction="http://microsoft.wcf.documentation/ISampleService/SampleMethodResponse")] - [System.ServiceModel.FaultContractAttribute(typeof(microsoft.wcf.documentation.SampleFault), Action="http://microsoft.wcf.documentation/ISampleService/SampleMethodSampleFaultFault")] + [System.ServiceModel.FaultContractAttribute(typeof(SampleFault), Action="http://microsoft.wcf.documentation/ISampleService/SampleMethodSampleFaultFault")] string SampleMethod(string msg); } @@ -70,26 +69,10 @@ public interface ISampleServiceChannel : ISampleService, System.ServiceModel.ICl [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] public partial class SampleServiceClient : System.ServiceModel.ClientBase, ISampleService { - public SampleServiceClient() { } - public SampleServiceClient(string endpointConfigurationName) : - base(endpointConfigurationName) - { - } - - public SampleServiceClient(string endpointConfigurationName, string remoteAddress) : - base(endpointConfigurationName, remoteAddress) - { - } - - public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : - base(endpointConfigurationName, remoteAddress) - { - } - public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { diff --git a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/services.cs b/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/services.cs deleted file mode 100644 index a7dc0b3f748..00000000000 --- a/snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/services.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.Serialization; -using System.ServiceModel; -using System.Text; - -namespace Microsoft.WCF.Documentation -{ - [ServiceContractAttribute(Namespace="http://microsoft.wcf.documentation")] - public interface ISampleService{ - - [OperationContractAttribute] - [FaultContractAttribute(typeof(SampleFault))] - string SampleMethod(string msg); - } - - class SampleService : ISampleService - { - public string SampleMethod(string msg) - { - Console.WriteLine("The caller said: \"{0}\"", msg); - return "The service greets you: " + msg; - } - } - - // The detail type of the specified SOAP fault. - [DataContractAttribute(Namespace = "http://microsoft.wcf.documentation")] - public class SampleFault - { - [DataMemberAttribute(Name="FaultMessage")] - private string msg; - - public string FaultMessage - { - get { return this.msg; } - set { this.msg = value; } - } - } -} diff --git a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Client/client.csproj b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Client/client.csproj index fa06ed73113..e8b3b46ba37 100644 --- a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Client/client.csproj +++ b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Client/client.csproj @@ -1,91 +1,28 @@ - - + - Debug - AnyCPU - {66190530-B4E3-4BF0-94B4-DFE52D15E50F} Exe - false + net10.0 Client Microsoft.WCF.Documentation - v4.8 - - - - - 2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - + disable + disable + false - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - AllRules.ruleset - - - pdbonly - true - .\bin\Release\ - TRACE - AllRules.ruleset - - - - - - - - - + + Always + - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - + + + - - - - - - - - - \ No newline at end of file + diff --git a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/host.csproj b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/host.csproj index 5cd2935bb28..9be0cdb7e21 100644 --- a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/host.csproj +++ b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/host.csproj @@ -1,85 +1,13 @@ - - + - Debug - AnyCPU - {907F0C93-0FC2-4419-B0CE-2B775830A3C2} - Exe - false + net10.0 HostApplication Microsoft.WCF.Documentation - v4.8 - - - - - 2.0 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - + disable + disable - - true - full - false - .\bin\Debug\ - DEBUG;TRACE - AllRules.ruleset - - - pdbonly - true - .\bin\Release\ - TRACE - AllRules.ruleset - - - - - - - False - ..\..\..\..\..\Program Files\Reference Assemblies\Microsoft\WinFX\v3.0\System.Runtime.Serialization.dll - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - + + - - - - - \ No newline at end of file + diff --git a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/hostapplication.cs b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/hostapplication.cs index d99c1efd630..506d5a26fab 100644 --- a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/hostapplication.cs +++ b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/hostapplication.cs @@ -1,51 +1,45 @@ using System; -using System.Configuration; -using System.Collections.Generic; -using System.ServiceModel; -using System.Text; +using CoreWCF; +using CoreWCF.Configuration; +using CoreWCF.Description; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; namespace Microsoft.WCF.Documentation { class HostApplication { - static void Main() + static void Main(string[] args) { HostApplication app = new HostApplication(); - app.Run(); + app.Run(args); } - private void Run() + private void Run(string[] args) { - // Create a ServiceHost for the service type and use the base address from configuration. - using (ServiceHost serviceHost = new ServiceHost(typeof(SampleService))) + WebApplicationBuilder builder = WebApplication.CreateBuilder(args); + builder.WebHost.UseUrls("http://localhost:8080"); + builder.Services.AddServiceModelServices(); + builder.Services.AddServiceModelMetadata(); + + WebApplication app = builder.Build(); + + app.UseServiceModel(serviceBuilder => { - try - { - // Open the ServiceHostBase to create listeners and start listening for messages. - serviceHost.Open(); + serviceBuilder.AddServiceEndpoint( + new WSHttpBinding(SecurityMode.Message), + "/SampleService"); - // The service can now be accessed. - Console.WriteLine("The service is ready."); - Console.WriteLine("Press to terminate service."); - Console.ReadLine(); + ServiceMetadataBehavior serviceMetadataBehavior = + app.Services.GetRequiredService(); + serviceMetadataBehavior.HttpGetEnabled = true; + }); - // Close the ServiceHostBase to shutdown the service. - serviceHost.Close(); - } - catch (TimeoutException timeProblem) - { - Console.WriteLine("The service operation timed out. " + timeProblem.Message); - Console.ReadLine(); - serviceHost.Abort(); - } - catch (CommunicationException commProblem) - { - Console.WriteLine("There was a communication problem. " + commProblem.Message); - Console.ReadLine(); - serviceHost.Abort(); - } - } + Console.WriteLine("The service is ready."); + Console.WriteLine("Press Ctrl+C to terminate service."); + app.Run(); } } } diff --git a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/services.cs b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/services.cs index 65cc0322112..6ce5f93c359 100644 --- a/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/services.cs +++ b/snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/services.cs @@ -1,9 +1,8 @@ // using System; using System.Collections.Generic; -using System.Net.Security; using System.Runtime.Serialization; -using System.ServiceModel; +using CoreWCF; using System.Text; namespace Microsoft.WCF.Documentation @@ -14,8 +13,7 @@ public interface ISampleService{ [OperationContract] [FaultContractAttribute( typeof(GreetingFault), - Action="http://www.contoso.com/GreetingFault", - ProtectionLevel=ProtectionLevel.EncryptAndSign + Action="http://www.contoso.com/GreetingFault" )] string SampleMethod(string msg); // @@ -39,7 +37,7 @@ public string Message } } - class SampleService : ISampleService + public class SampleService : ISampleService { #region ISampleService Members diff --git a/xml/System.ServiceModel/CallbackBehaviorAttribute.xml b/xml/System.ServiceModel/CallbackBehaviorAttribute.xml index 60db32f2fd9..c8c7a6eeb35 100644 --- a/xml/System.ServiceModel/CallbackBehaviorAttribute.xml +++ b/xml/System.ServiceModel/CallbackBehaviorAttribute.xml @@ -90,10 +90,12 @@ - The property informs the system whether it should confirm that SOAP headers marked as `MustUnderstand` have, in fact, been understood. - - ## Examples - The following code example shows a on a callback object that uses the object to determine which thread to marshal to, the property to enforce message validation, and the property to return exceptions as objects to the service for debugging purposes. + The following code example shows a on a callback object that uses: + + - The object to determine which thread to marshal to. + - The property to enforce message validation. + - And the property to return exceptions as objects to the service for debugging purposes. :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/callbackbehaviorattribute/vb/client.vb" id="Snippet3"::: @@ -139,21 +141,18 @@ The default settings for the are: - The property is `true`. - - The is set to . - - The property is `false`. - -- is `false`. - -- is `false`. - +- is `false`. +- is `false`. - The property is `true`. - - ## Examples - The following code example shows a on a callback object that uses the object to determine which thread to marshal to, the property to enforce message validation, and the property to return exceptions as objects to the service for debugging purposes. + The following code example shows a on a callback object that uses: + + - The object to determine which thread to marshal to. + - The property to enforce message validation. + - And the property to return exceptions as objects to the service for debugging purposes. :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/callbackbehaviorattribute/vb/client.vb" id="Snippet3"::: @@ -333,12 +332,14 @@ Set to `true` to enable exception information to flow back to services for debugging purposes when possible. This is a development-only feature and should not be employed in deployed services. These faults appear to the calling service as objects. > [!IMPORTANT] -> Setting to `true` enables services to obtain information about internal client callback exceptions; it is only recommended as a way of temporarily debugging a duplex client application. - - +> Setting to `true` enables services to obtain information about internal client callback exceptions; it is only recommended as a way of temporarily debugging a duplex client application. ## Examples - The following code example shows a on a callback object that uses the object to determine which thread to marshal to, the property to enforce message validation, and the property to return exceptions as objects to the service for debugging purposes. + The following code example shows a on a callback object that uses: + + - The object to determine which thread to marshal to. + - The property to enforce message validation. + - And the property to return exceptions as objects to the service for debugging purposes. :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/callbackbehaviorattribute/vb/client.vb" id="Snippet3"::: @@ -667,14 +668,17 @@ is set to `true`, synchronizes all calls to the service to run on the user interface thread. - - Note that the thread used is the current synchronization thread when or is called. In the case of an Windows Forms application, this means that these calls should occur after a call to the method. +Use this property to provide the user interface thread affinity that some applications require. For example, a Windows Forms application may be registered as a singleton service object. In this case, all calls into the service must run on the Windows Forms thread. The default case, in which is set to `true`, synchronizes all calls to the service to run on the user interface thread. +The thread used is the current synchronization thread when or is called. In the case of an Windows Forms application, this means that these calls should occur after a call to the method. ## Examples - The following code example shows a on a callback object that uses the object to determine which thread to marshal to, the property to enforce message validation, and the property to return exceptions as objects to the service for debugging purposes. + The following code example shows a on a callback object that uses: + + - The object to determine which thread to marshal to. + - The property to enforce message validation. + - And the property to return exceptions as objects to the service for debugging purposes. :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/callbackbehaviorattribute/vb/client.vb" id="Snippet3"::: @@ -714,10 +718,12 @@ ## Remarks Use the property to turn off the enforced validation of arriving message headers. In normal execution, message headers are compared against the property to confirm that arriving headers are explicitly handled by the callback object runtime. Set this to `false` to disable this checking. When set to `false`, the application must check for headers marked with MustUnderstand="true" and return a fault if one or more of them were not understood. This is useful when the callback is supposed to accept any incoming SOAP messages (for example, when using typed or untyped messages) and perform custom header processing. - - ## Examples - The following code example shows a on a callback object that uses the object to determine which thread to marshal to, the property to enforce message validation, and the property to return exceptions as objects to the service for debugging purposes. + The following code example shows a on a callback object that uses: + + - The object to determine which thread to marshal to. + - The property to enforce message validation. + - And the property to return exceptions as objects to the service for debugging purposes. :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/callbackbehaviorattribute/vb/client.vb" id="Snippet3"::: diff --git a/xml/System.ServiceModel/ClientBase`1.xml b/xml/System.ServiceModel/ClientBase`1.xml index cf719e6f601..eadc02d4970 100644 --- a/xml/System.ServiceModel/ClientBase`1.xml +++ b/xml/System.ServiceModel/ClientBase`1.xml @@ -208,12 +208,10 @@ ## Remarks Use this constructor when the service contract requires a callback service instance. The target endpoint is constructed from the type parameter and information in the application configuration file. - - ## Examples The following code example shows how to use this constructor with a `SampleDuplexHelloClient` class to pass a callback object that listens for messages from the service. - :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet3"::: + :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/callbackbehaviorattribute/vb/client.vb" id="Snippet3"::: ]]> diff --git a/xml/System.ServiceModel/DuplexClientBase`1.xml b/xml/System.ServiceModel/DuplexClientBase`1.xml index 86baaf4d2ed..dbe2ca1ed3d 100644 --- a/xml/System.ServiceModel/DuplexClientBase`1.xml +++ b/xml/System.ServiceModel/DuplexClientBase`1.xml @@ -74,7 +74,7 @@ - Avoid finalizers; but if you include one, you should suppress the build warning and call and the finalizer itself from (On)(Begin)Close (and/or OnAbort) in order to emulate what would have been the auto-generated behavior. ## Examples - The following example shows the use in the client of a duplex WCF client type, the `SampleDuplexHelloClient`, to pass a new object with the callback object to listen for callbacks. + The following example shows how to use this type in the client of a duplex WCF client type (`SampleDuplexHelloClient`) to pass a new object with the callback object to listen for callbacks. :::code language="csharp" source="~/snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CFX/callbackbehaviorattribute/vb/client.vb" id="Snippet3":::