├── .gitignore ├── Behaviors └── PocoServiceHost │ ├── PocoServiceBehavior.cs │ ├── PocoServiceHost.cs │ ├── PocoServiceHost.csproj │ ├── PocoServiceHost.sln │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── app.config ├── DataContractResolver ├── Client │ ├── Client.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── app.config ├── Common │ ├── Common.csproj │ ├── DynamicTypeBuilder.cs │ ├── DynamicTypeResolver.cs │ ├── MyHolder.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── DataContractResolverForDynamicTypes.sln └── Server │ ├── DynamicService.cs │ ├── IDynamicContract.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Server.csproj │ └── app.config ├── ExtensibleObjects └── SharingDataThroughPipeline │ ├── CalculatorService.cs │ ├── ICalculator.cs │ ├── MyChannelExtension.cs │ ├── MyInspector.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SharingDataThroughPipeline.csproj │ ├── SharingDataThroughPipeline.sln │ └── app.config ├── IErrorHandler ├── ParameterValidation │ ├── Contact.cs │ ├── ContactManager.svc │ ├── ContactManager.svc.cs │ ├── ContactManagerFactory.cs │ ├── Default.htm │ ├── ParameterValidation.csproj │ ├── ParameterValidation.sln │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── UnitTests.htm │ ├── ValidatingParameterInspector.cs │ ├── ValidationAwareErrorHandler.cs │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── WebHttpWithValidationBehavior.cs │ └── scripts │ │ ├── json2.js │ │ ├── qunit.css │ │ └── qunit.js └── ParameterValidationWithSoap │ ├── Contact.cs │ ├── ContactManager.cs │ ├── ParameterValidationWithSoap.csproj │ ├── ParameterValidationWithSoap.sln │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── ValidatingBehavior.cs │ ├── ValidatingParameterInspector.cs │ ├── ValidationAwareErrorHandler.cs │ └── app.config ├── InitializerSamples ├── GlobAwareService │ ├── GlobAwareCallContextInitializer.cs │ ├── GlobAwareEndpointBehavior.cs │ ├── GlobAwareService.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Service.cs │ ├── StringRetriever.cs │ └── app.config ├── InitializerSamples.sln └── TrackingClients │ ├── ClientTrackerChannelInitializer.cs │ ├── ClientTrackerEndpointBehavior.cs │ ├── Contracts.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── TrackingClients.csproj │ └── app.config ├── InstanceContext └── SimulatedSessions │ ├── Contracts.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SharedSessionEndpointBehavior.cs │ ├── SharedSessionInstanceContextProvider.cs │ ├── SimulatedSessions.csproj │ ├── SimulatedSessions.sln │ └── app.config ├── InstanceProvider └── TestableWcfServices │ ├── Local.testsettings │ ├── PricingService.Test │ ├── AnyInstance.cs │ ├── MockProductRepository.cs │ ├── PricingService.Test.csproj │ ├── PricingServiceInWCFTest.cs │ ├── PricingServiceTest.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── PricingService │ ├── DataContracts.cs │ ├── FileBasedProductRepository.cs │ ├── IPricingService.cs │ ├── IProductRepository.cs │ ├── InstanceProviderBehavior.cs │ ├── PricingService.cs │ ├── PricingService.csproj │ ├── ProductRepositoryFactory.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── app.config │ ├── TestableWcfServices.sln │ ├── TestableWcfServices.vsmdi │ └── TraceAndTestImpact.testsettings ├── InteractiveChannelInitializer ├── Client │ ├── AsyncResult.cs │ ├── Client.csproj │ ├── ClientCredentialsEx.cs │ ├── ClientForm.Designer.cs │ ├── ClientForm.cs │ ├── ClientForm.resx │ ├── ClientPasswordDialog.Designer.cs │ ├── ClientPasswordDialog.cs │ ├── ClientPasswordDialog.resx │ ├── MyClientCredentialsSecurityTokenManager.cs │ ├── MyUserNameSecurityTokenProvider.cs │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── Service References │ │ └── ServiceReference1 │ │ │ ├── Reference.cs │ │ │ ├── Reference.svcmap │ │ │ ├── Service.disco │ │ │ ├── Service.wsdl │ │ │ ├── Service.xsd │ │ │ ├── Service1.xsd │ │ │ ├── configuration.svcinfo │ │ │ └── configuration91.svcinfo │ ├── ShowCredentialsUI.cs │ └── app.config ├── InteractiveChannelInitializer.sln └── Server │ ├── CustomAuthorizationPolicy.cs │ ├── CustomPrincipal.cs │ ├── MyPasswordValidator.cs │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Server.csproj │ ├── ServerForm.Designer.cs │ ├── ServerForm.cs │ ├── ServerForm.resx │ ├── Service.cs │ └── app.config ├── MessageEncoder ├── ChangeXmlPrefixes │ ├── CalculatorService.cs │ ├── ChangeXmlPrefixes.csproj │ ├── ChangeXmlPrefixes.sln │ ├── ICalculator.cs │ ├── LoggingMessageEncodingBindingElement.cs │ ├── PrefixReplacer.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ReplacePrefixMessageEncodingBindingElement.cs │ └── app.config ├── CompositeEncoder │ ├── CompositeEncoder.csproj │ ├── CompositeEncoder.sln │ ├── Contracts.cs │ ├── MyReadMtomWriteXmlEncoder.cs │ ├── MyReadMtomWriteXmlEncoderFactory.cs │ ├── MyReadMtomWriteXmlEncodingBindingElement.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── app.config └── GZipEncoderAndAutoFormatSelection │ ├── App.config │ ├── CompressionAndFormatSelectionMessageInspector.cs │ ├── GZipEncoder.cs │ ├── GZipEncoderAndAutoFormatSelection.csproj │ ├── GZipEncoderAndAutoFormatSelection.sln │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── Service.cs ├── MessageFormatter ├── MessageFormatter │ ├── JsonNetMessageFormatter │ │ ├── DataContracts.cs │ │ ├── ITestService.cs │ │ ├── JsonNetMessageFormatter.csproj │ │ ├── NewtonsoftJsonBehavior.cs │ │ ├── NewtonsoftJsonClientFormatter.cs │ │ ├── NewtonsoftJsonDispatchFormatter.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RawBodyWriter.cs │ │ ├── Service.cs │ │ └── app.config │ ├── MessageFormatter.sln │ └── lib │ │ └── Newtonsoft.Json.dll └── PerOperationContentTypeMapper │ ├── DualModeFormatter.cs │ ├── DualModeWebHttpBehavior.cs │ ├── NonRawAttribute.cs │ ├── PerOperationContentTypeMapper.csproj │ ├── PerOperationContentTypeMapper.sln │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── RawContentTypeMapper.cs │ ├── Service.cs │ └── app.config ├── MessageInspector └── InspectNonXmlMessages │ ├── ContactManagerService.cs │ ├── Contracts.cs │ ├── IncomingMessageLogger.cs │ ├── InspectNonXmlMessages.csproj │ ├── InspectNonXmlMessages.sln │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── app.config ├── OperationInvoker └── CachingOperationInvoker │ ├── CacheableOperationAttribute.cs │ ├── CachingOperationInvoker.cs │ ├── CachingOperationInvoker.csproj │ ├── CachingOperationInvoker.sln │ ├── Interface.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Service.cs │ └── app.config ├── OperationSelector └── HttpMethodOverrideOperationSelection │ ├── ContactManagerService.cs │ ├── Contracts.cs │ ├── HttpMethodOverrideOperationSelection.csproj │ ├── HttpMethodOverrideOperationSelection.sln │ ├── HttpOverrideBehavior.cs │ ├── HttpOverrideOperationSelector.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── app.config ├── README ├── Scenarios └── CORS │ ├── CORS.sln │ ├── CorsEnabledService │ ├── CorsConstants.cs │ ├── CorsEnabledAttribute.cs │ ├── CorsEnabledMessageInspector.cs │ ├── CorsEnabledService.csproj │ ├── CorsEnabledServiceHostFactory.cs │ ├── EnableCorsEndpointBehavior.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── IValues.cs │ ├── PreflightOperationBehavior.cs │ ├── PreflightOperationInvoker.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TestPage.htm │ ├── ValuesService.cs │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── scripts │ │ └── jquery-1.7.2.js │ └── MashupApp │ ├── Default.htm │ ├── MashupApp.csproj │ ├── Properties │ └── AssemblyInfo.cs │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── scripts │ └── jquery-1.7.2.js ├── Silverlight ├── JsonClient │ ├── JsonClient.sln │ ├── SLApp.Web │ │ ├── IRestService.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── RestService.svc │ │ ├── RestService.svc.cs │ │ ├── SLApp.Web.csproj │ │ ├── SLAppTestPage.aspx │ │ ├── SLAppTestPage.html │ │ ├── Silverlight.js │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ └── Web.config │ └── SLApp │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── MainPage.xaml │ │ ├── MainPage.xaml.cs │ │ ├── Properties │ │ ├── AppManifest.xml │ │ └── AssemblyInfo.cs │ │ ├── SLApp.csproj │ │ └── WebMessageEncodingBindingElement.cs └── StreamedResponses │ ├── SLApp.Web │ ├── IWcfDownloadService.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SLApp.Web.csproj │ ├── SLAppTestPage.aspx │ ├── SLAppTestPage.html │ ├── Silverlight.js │ ├── WcfDownloadService.svc │ ├── WcfDownloadService.svc.cs │ ├── Web.Debug.config │ ├── Web.Release.config │ └── Web.config │ ├── SLApp │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Properties │ │ ├── AppManifest.xml │ │ └── AssemblyInfo.cs │ ├── SLApp.csproj │ ├── Service References │ │ └── ServiceReference1 │ │ │ ├── Reference.cs │ │ │ ├── Reference.svcmap │ │ │ ├── WcfDownloadService.disco │ │ │ ├── WcfDownloadService.wsdl │ │ │ ├── WcfDownloadService.xsd │ │ │ ├── WcfDownloadService1.wsdl │ │ │ ├── WcfDownloadService1.xsd │ │ │ ├── WcfDownloadService2.xsd │ │ │ ├── configuration.svcinfo │ │ │ └── configuration91.svcinfo │ └── ServiceReferences.ClientConfig │ └── StreamedResponses.sln ├── SilverlightSelfHostedService ├── SLApp.Web │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SLApp.Web.csproj │ ├── SLAppTestPage.aspx │ ├── SLAppTestPage.html │ ├── Silverlight.js │ ├── Web.Debug.config │ ├── Web.Release.config │ └── Web.config ├── SLApp │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Properties │ │ ├── AppManifest.xml │ │ └── AssemblyInfo.cs │ ├── SLApp.csproj │ ├── Service References │ │ └── ServiceReference1 │ │ │ ├── Reference.cs │ │ │ ├── Reference.svcmap │ │ │ ├── Service.wsdl │ │ │ ├── configuration.svcinfo │ │ │ ├── configuration91.svcinfo │ │ │ ├── item.disco │ │ │ ├── item.xsd │ │ │ ├── item1.xsd │ │ │ └── item2.xsd │ └── ServiceReferences.ClientConfig ├── SelfHostedService │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SelfHostedService.csproj │ └── app.config └── SilverlightSelfHostedService.sln ├── SilverlightTcpSelfHostedService ├── SLApp.Web │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SLApp.Web.csproj │ ├── SLAppTestPage.aspx │ ├── SLAppTestPage.html │ ├── Silverlight.js │ ├── Web.Debug.config │ ├── Web.Release.config │ └── Web.config ├── SLApp │ ├── App.xaml │ ├── App.xaml.cs │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Properties │ │ ├── AppManifest.xml │ │ └── AssemblyInfo.cs │ ├── SLApp.csproj │ ├── Service References │ │ └── ServiceReference1 │ │ │ ├── Reference.cs │ │ │ ├── Reference.svcmap │ │ │ ├── configuration.svcinfo │ │ │ ├── configuration91.svcinfo │ │ │ ├── service.wsdl │ │ │ ├── service.xsd │ │ │ └── service1.xsd │ └── ServiceReferences.ClientConfig ├── Service │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Service.csproj │ └── app.config └── SilverlightTcpSelfHostedService.sln ├── StreamingInsideDataContracts ├── Client │ ├── Client.csproj │ ├── ContextExtra.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SomeServiceImpl.cs │ └── app.config ├── Server │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Server.csproj │ └── app.config └── StreamingInsideDataContracts.sln ├── TransportChannels ├── CustomTcpDuplexTransport │ ├── Channels │ │ ├── AsyncResult.cs │ │ ├── Channels.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SizedTcpBaseChannel.cs │ │ ├── SizedTcpDuplexChannel.cs │ │ ├── SizedTcpDuplexChannelFactory.cs │ │ ├── SizedTcpDuplexChannelListener.cs │ │ └── SizedTcpDuplexTransportBindingElement.cs │ ├── CustomTcpDuplexTransport.sln │ ├── Utils │ │ ├── Debugging.cs │ │ ├── Formatting.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Utils.csproj │ ├── WcfClient │ │ ├── Dispatcher.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SocketServer.cs │ │ ├── WcfClient.csproj │ │ └── app.config │ ├── WcfDuplex │ │ ├── Contracts.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Service.cs │ │ ├── WcfDuplex.csproj │ │ └── app.config │ └── WcfServer │ │ ├── Contracts.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── WcfServer.csproj │ │ └── app.config └── JsonRpcOverTcp │ ├── Channels.Test │ ├── BaseChannelTests.cs │ ├── Channels.Test.csproj │ ├── Mocks.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ReflectionHelper.cs │ ├── RequestChannelTests.cs │ └── SimpleEchoServer.cs │ ├── Channels │ ├── AsyncResult.cs │ ├── Channels.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SizedTcpBaseChannel.cs │ ├── SizedTcpChannelFactory.cs │ ├── SizedTcpChannelListener.cs │ ├── SizedTcpReplyChannel.cs │ ├── SizedTcpRequestChannel.cs │ ├── SizedTcpRequestContext.cs │ └── SizedTcpTransportBindingElement.cs │ ├── ConsoleTester │ ├── ConsoleTester.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs │ ├── JsonRpcOverTcp.sln │ ├── ServiceModel │ ├── JsonRpcConstants.cs │ ├── JsonRpcEndpointBehavior.cs │ ├── JsonRpcErrorHandler.cs │ ├── JsonRpcException.cs │ ├── JsonRpcHelpers.cs │ ├── JsonRpcMessageFormatter.cs │ ├── JsonRpcMessageInspector.cs │ ├── JsonRpcOperationSelector.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── ServiceModel.csproj │ ├── SimpleServer │ ├── Dispatcher.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SimpleServer.cs │ ├── SimpleServer.csproj │ └── app.config │ ├── Utils │ ├── Debugging.cs │ ├── Formatting.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── RawBodyWriter.cs │ └── Utils.csproj │ ├── WcfClient │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── WcfClient.csproj │ └── app.config │ ├── WcfServer │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Service.cs │ ├── WcfServer.csproj │ └── app.config │ └── lib │ ├── Newtonsoft.Json.dll │ ├── Newtonsoft.Json.xml │ ├── xunit.dll │ ├── xunit.extensions.dll │ ├── xunit.extensions.xml │ └── xunit.xml ├── WCFBinaryTools ├── BinaryFormatParser │ ├── BinaryFormatParser.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── WcfDictionary.cs │ ├── XmlBinaryElements.cs │ ├── XmlBinaryNodeType.cs │ └── XmlBinaryParser.cs ├── SerializeWithSessionDictionary │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── SerializeWithSessionDictionary.csproj ├── WcfBinaryParser │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── WcfBinaryParser.csproj ├── WcfBinaryTools.sln └── WcfBinaryViewer │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── WcfBinaryViewer.csproj │ ├── XmlBinaryViewer.Designer.cs │ ├── XmlBinaryViewer.cs │ └── XmlBinaryViewer.resx ├── WCFRiaServices └── CallingRIAFromForms │ ├── CallingRIAFromForms.sln │ ├── SLApp.Web │ ├── CanReceiveFormsUrlEncodedInputAttribute.cs │ ├── ContactImporter.htm │ ├── ContactsDomainService.cs │ ├── FormUrlEncodedEnabledJsonEndpointFactory.cs │ ├── GlobalSuppressions.cs │ ├── HelpEnabledJsonEndpointFactory.cs │ ├── Models │ │ ├── Contact.cs │ │ ├── ContactRepository.cs │ │ ├── RegistrationData.cs │ │ ├── Shared │ │ │ └── User.shared.cs │ │ └── User.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── RegistrationDataResources.Designer.cs │ │ ├── RegistrationDataResources.resx │ │ ├── ValidationErrorResources.Designer.cs │ │ └── ValidationErrorResources.resx │ ├── SLApp.Web.csproj │ ├── SLAppTestPage.aspx │ ├── SLAppTestPage.html │ ├── Services │ │ ├── AuthenticationService.cs │ │ └── UserRegistrationService.cs │ ├── Silverlight.js │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ └── scripts │ │ ├── jquery-1.7.1.js │ │ └── json2.js │ └── SLApp │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ ├── Resources │ │ ├── ApplicationResources.cs │ │ ├── ApplicationStrings.Designer.cs │ │ ├── ApplicationStrings.resx │ │ ├── ErrorResources.Designer.cs │ │ ├── ErrorResources.resx │ │ ├── SecurityQuestions.Designer.cs │ │ └── SecurityQuestions.resx │ └── Styles.xaml │ ├── Controls │ ├── BusyIndicator.cs │ ├── BusyIndicator.xaml │ └── VisualStates.cs │ ├── Generated_Code │ ├── Models │ │ └── Shared │ │ │ └── User.shared.cs │ └── SLApp.Web.g.cs │ ├── GlobalSuppressions.cs │ ├── Helpers │ ├── DataFieldExtensions.cs │ ├── NotOperatorValueConverter.cs │ └── TargetNullValueConverter.cs │ ├── Libs │ └── System.Windows.Controls.Data.DataForm.Toolkit.dll │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Models │ ├── LoginInfo.cs │ ├── RegistrationData.partial.cs │ └── User.partial.cs │ ├── Properties │ ├── AppManifest.xml │ ├── AssemblyInfo.cs │ └── OutOfBrowserSettings.xml │ ├── SLApp.csproj │ └── Views │ ├── About.xaml │ ├── About.xaml.cs │ ├── ErrorWindow.xaml │ ├── ErrorWindow.xaml.cs │ ├── Home.xaml │ ├── Home.xaml.cs │ └── Login │ ├── LoginForm.xaml │ ├── LoginForm.xaml.cs │ ├── LoginRegistrationWindow.xaml │ ├── LoginRegistrationWindow.xaml.cs │ ├── LoginStatus.xaml │ ├── LoginStatus.xaml.cs │ ├── RegistrationForm.xaml │ └── RegistrationForm.xaml.cs ├── WcfRuntime ├── AllExtensions │ ├── AllExtensions.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs └── WcfRuntime.sln └── shoebox ├── JsonRpc └── DuplexChannels │ ├── SizedTcpDuplexChannel.cs │ ├── SizedTcpDuplexChannelFactory.cs │ ├── SizedTcpDuplexChannelListener.cs │ └── SizedTcpDuplexTransportBindingElement.cs └── README /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio files # 2 | ####################### 3 | *.suo 4 | *.csproj.user 5 | bin/ 6 | obj/ 7 | ClientBin/ 8 | -------------------------------------------------------------------------------- /Behaviors/PocoServiceHost/PocoServiceHost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Description; 4 | 5 | namespace PocoServiceHost 6 | { 7 | public class PocoServiceHost : ServiceHost 8 | { 9 | public PocoServiceHost(Type serviceType, Uri baseAddress) 10 | : base(serviceType, baseAddress) 11 | { 12 | } 13 | 14 | protected override void InitializeRuntime() 15 | { 16 | this.Description.Behaviors.Insert(0, new PocoServiceBehavior()); 17 | this.Description.Behaviors.Add(new ServiceMetadataBehavior { HttpGetEnabled = true }); 18 | base.InitializeRuntime(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Behaviors/PocoServiceHost/PocoServiceHost.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C# Express 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PocoServiceHost", "PocoServiceHost.csproj", "{3EEDDFC6-7357-400A-B07F-3E6B8AA92007}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {3EEDDFC6-7357-400A-B07F-3E6B8AA92007}.Debug|x86.ActiveCfg = Debug|x86 13 | {3EEDDFC6-7357-400A-B07F-3E6B8AA92007}.Debug|x86.Build.0 = Debug|x86 14 | {3EEDDFC6-7357-400A-B07F-3E6B8AA92007}.Release|x86.ActiveCfg = Release|x86 15 | {3EEDDFC6-7357-400A-B07F-3E6B8AA92007}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Behaviors/PocoServiceHost/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PocoServiceHost")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PocoServiceHost")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5fb3ace0-6851-4c21-8aa9-b52233d9e5c6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Behaviors/PocoServiceHost/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DataContractResolver/Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Client")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Client")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d8792fca-41af-4deb-ad12-4de9bddfe6e3")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DataContractResolver/Client/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /DataContractResolver/Common/MyHolder.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Common 4 | { 5 | [DataContract] 6 | public class MyHolder 7 | { 8 | [DataMember] 9 | public object MyObject { get; set; } 10 | 11 | public override string ToString() 12 | { 13 | return string.Format("MyHolder[MyObject={0}]", this.MyObject); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DataContractResolver/Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Common")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Common")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("95af7ed4-d64b-4f7a-8773-89b107c7bc17")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DataContractResolver/Server/DynamicService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Common; 3 | 4 | namespace Server 5 | { 6 | public class DynamicService : IDynamicContract 7 | { 8 | public MyHolder EchoHolder(MyHolder holder) 9 | { 10 | Console.WriteLine("In service, holder = {0}", holder); 11 | return holder; 12 | } 13 | 14 | public MyHolder GetHolder(string typeName, string[] propertyNames, object[] propertyValues) 15 | { 16 | Console.WriteLine("In service, creating a type called {0}", typeName); 17 | Type type = DynamicTypeBuilder.Instance.GetDynamicType(typeName); 18 | object instance = Activator.CreateInstance(type); 19 | for (int i = 0; i < propertyNames.Length; i++) 20 | { 21 | type.GetProperty(propertyNames[i]).SetValue(instance, propertyValues[i], null); 22 | } 23 | 24 | return new MyHolder { MyObject = instance }; 25 | } 26 | 27 | public string PutHolder(MyHolder holder) 28 | { 29 | Console.WriteLine("In service, holder = {0}", holder); 30 | return holder.ToString(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DataContractResolver/Server/IDynamicContract.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using Common; 3 | 4 | namespace Server 5 | { 6 | [ServiceContract(Name = "IDynamicContract", Namespace = "http://my.dynamic.contract")] 7 | public interface IDynamicContract 8 | { 9 | [OperationContract] 10 | MyHolder EchoHolder(MyHolder holder); 11 | [OperationContract] 12 | MyHolder GetHolder(string typeName, string[] propertyNames, object[] propertyValues); 13 | [OperationContract] 14 | string PutHolder(MyHolder holder); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DataContractResolver/Server/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Description; 4 | using Common; 5 | 6 | namespace Server 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | string baseAddress = "http://" + Environment.MachineName + ":8000/Service"; 13 | ServiceHost host = new ServiceHost(typeof(DynamicService), new Uri(baseAddress)); 14 | ServiceEndpoint endpoint = host.AddServiceEndpoint(typeof(IDynamicContract), new BasicHttpBinding(), ""); 15 | foreach (OperationDescription operation in endpoint.Contract.Operations) 16 | { 17 | operation.Behaviors.Find().DataContractResolver = new DynamicTypeResolver(); 18 | } 19 | 20 | host.Open(); 21 | Console.WriteLine("Host opened, press ENTER to close"); 22 | Console.ReadLine(); 23 | host.Close(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DataContractResolver/Server/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Server")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Server")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("550b4628-9a70-443c-a401-dfe4592ffafd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DataContractResolver/Server/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ExtensibleObjects/SharingDataThroughPipeline/CalculatorService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharingDataThroughPipeline 4 | { 5 | public class CalculatorService : ICalculator 6 | { 7 | public double Add(double x, double y) 8 | { 9 | return x + y; 10 | } 11 | 12 | public double Subtract(double x, double y) 13 | { 14 | return x - y; 15 | } 16 | 17 | public double Multiply(double x, double y) 18 | { 19 | return x * y; 20 | } 21 | 22 | public double Divide(double x, double y) 23 | { 24 | return x / y; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ExtensibleObjects/SharingDataThroughPipeline/ICalculator.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | 3 | namespace SharingDataThroughPipeline 4 | { 5 | [ServiceContract] 6 | public interface ICalculator 7 | { 8 | [OperationContract] 9 | double Add(double x, double y); 10 | [OperationContract] 11 | double Subtract(double x, double y); 12 | [OperationContract] 13 | double Multiply(double x, double y); 14 | [OperationContract] 15 | double Divide(double x, double y); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ExtensibleObjects/SharingDataThroughPipeline/MyChannelExtension.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using System.ServiceModel.Channels; 3 | 4 | namespace SharingDataThroughPipeline 5 | { 6 | class MyChannelExtension : IExtension 7 | { 8 | public Binding Binding { get; set; } 9 | public bool IntroduceErrors { get; set; } 10 | 11 | // Not used in this scenario 12 | public void Attach(IContextChannel owner) { } 13 | public void Detach(IContextChannel owner) { } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ExtensibleObjects/SharingDataThroughPipeline/SharingDataThroughPipeline.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharingDataThroughPipeline", "SharingDataThroughPipeline.csproj", "{5FD37440-D2C6-4A2F-9114-0C243E8832CE}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {5FD37440-D2C6-4A2F-9114-0C243E8832CE}.Debug|x86.ActiveCfg = Debug|x86 13 | {5FD37440-D2C6-4A2F-9114-0C243E8832CE}.Debug|x86.Build.0 = Debug|x86 14 | {5FD37440-D2C6-4A2F-9114-0C243E8832CE}.Release|x86.ActiveCfg = Release|x86 15 | {5FD37440-D2C6-4A2F-9114-0C243E8832CE}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /ExtensibleObjects/SharingDataThroughPipeline/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/Contact.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Runtime.Serialization; 3 | 4 | namespace ParameterValidation 5 | { 6 | [DataContract] 7 | public class Contact 8 | { 9 | [DataMember] 10 | [Required(ErrorMessage = "Name is required")] 11 | [StringLength(20, MinimumLength = 1, ErrorMessage = "Name must have between 1 and 20 characters")] 12 | public string Name { get; set; } 13 | 14 | [DataMember] 15 | [Range(0, 150, ErrorMessage = "Age must be an integer between 0 and 150")] 16 | public int Age { get; set; } 17 | 18 | [DataMember] 19 | [Required(ErrorMessage = "E-mail is required")] 20 | [RegularExpression(@"[^\@]+\@[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)+", ErrorMessage = "E-mail is invalid")] 21 | public string Email { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/ContactManager.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="ParameterValidation.ContactManager" CodeBehind="ContactManager.svc.cs" Factory="ParameterValidation.ContactManagerFactory" %> 2 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/ContactManagerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Activation; 4 | using System.ServiceModel.Description; 5 | 6 | namespace ParameterValidation 7 | { 8 | public class ContactManagerFactory : ServiceHostFactory 9 | { 10 | protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) 11 | { 12 | ServiceHost host = new ServiceHost(serviceType, baseAddresses); 13 | ServiceEndpoint endpoint = host.AddServiceEndpoint(serviceType, new WebHttpBinding(), ""); 14 | endpoint.Behaviors.Add(new WebHttpWithValidationBehavior()); 15 | return host; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/ParameterValidation.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Web Developer Express 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParameterValidation", "ParameterValidation.csproj", "{724BCFB7-3806-49C5-A61F-77B1E8A03535}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {724BCFB7-3806-49C5-A61F-77B1E8A03535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {724BCFB7-3806-49C5-A61F-77B1E8A03535}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {724BCFB7-3806-49C5-A61F-77B1E8A03535}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {724BCFB7-3806-49C5-A61F-77B1E8A03535}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ParameterValidation")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ParameterValidation")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("34da4ce1-e08f-4e21-b92e-c01372c03aa3")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/ValidatingParameterInspector.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ServiceModel.Dispatcher; 3 | 4 | namespace ParameterValidation 5 | { 6 | public class ValidatingParameterInspector : IParameterInspector 7 | { 8 | public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState) 9 | { 10 | } 11 | 12 | public object BeforeCall(string operationName, object[] inputs) 13 | { 14 | foreach (var input in inputs) 15 | { 16 | if (input != null) 17 | { 18 | ValidationContext context = new ValidationContext(input, null, null); 19 | Validator.ValidateObject(input, context, true); 20 | } 21 | } 22 | 23 | return null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidation/WebHttpWithValidationBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Description; 2 | using System.ServiceModel.Dispatcher; 3 | 4 | namespace ParameterValidation 5 | { 6 | public class WebHttpWithValidationBehavior : WebHttpBehavior 7 | { 8 | protected override void AddServerErrorHandlers(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 9 | { 10 | int errorHandlerCount = endpointDispatcher.ChannelDispatcher.ErrorHandlers.Count; 11 | base.AddServerErrorHandlers(endpoint, endpointDispatcher); 12 | IErrorHandler webHttpErrorHandler = endpointDispatcher.ChannelDispatcher.ErrorHandlers[errorHandlerCount]; 13 | endpointDispatcher.ChannelDispatcher.ErrorHandlers.RemoveAt(errorHandlerCount); 14 | ValidationAwareErrorHandler newHandler = new ValidationAwareErrorHandler(webHttpErrorHandler); 15 | endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(newHandler); 16 | } 17 | 18 | public override void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 19 | { 20 | base.ApplyDispatchBehavior(endpoint, endpointDispatcher); 21 | foreach (DispatchOperation operation in endpointDispatcher.DispatchRuntime.Operations) 22 | { 23 | operation.ParameterInspectors.Add(new ValidatingParameterInspector()); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidationWithSoap/Contact.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Runtime.Serialization; 3 | 4 | namespace ParameterValidationWithSoap 5 | { 6 | [DataContract] 7 | public class Contact 8 | { 9 | [DataMember] 10 | [Required(ErrorMessage = "Name is required")] 11 | [StringLength(20, MinimumLength = 1, ErrorMessage = "Name must have between 1 and 20 characters")] 12 | public string Name { get; set; } 13 | 14 | [DataMember] 15 | [Range(0, 150, ErrorMessage = "Age must be an integer between 0 and 150")] 16 | public int Age { get; set; } 17 | 18 | [DataMember] 19 | [Required(ErrorMessage = "E-mail is required")] 20 | [RegularExpression(@"[^\@]+\@[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)+", ErrorMessage = "E-mail is invalid")] 21 | public string Email { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidationWithSoap/ParameterValidationWithSoap.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C# Express 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParameterValidationWithSoap", "ParameterValidationWithSoap.csproj", "{9A763A68-174D-42D0-B5B2-4B5A22F057A6}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {9A763A68-174D-42D0-B5B2-4B5A22F057A6}.Debug|x86.ActiveCfg = Debug|x86 13 | {9A763A68-174D-42D0-B5B2-4B5A22F057A6}.Debug|x86.Build.0 = Debug|x86 14 | {9A763A68-174D-42D0-B5B2-4B5A22F057A6}.Release|x86.ActiveCfg = Release|x86 15 | {9A763A68-174D-42D0-B5B2-4B5A22F057A6}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidationWithSoap/ValidatingBehavior.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel.Description; 6 | using System.ServiceModel.Channels; 7 | using System.ServiceModel.Dispatcher; 8 | 9 | namespace ParameterValidationWithSoap 10 | { 11 | public class ValidatingBehavior : IEndpointBehavior 12 | { 13 | public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) 14 | { 15 | } 16 | 17 | public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) 18 | { 19 | } 20 | 21 | public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 22 | { 23 | endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(new ValidationAwareErrorHandler()); 24 | foreach (DispatchOperation op in endpointDispatcher.DispatchRuntime.Operations) 25 | { 26 | op.ParameterInspectors.Add(new ValidatingParameterInspector()); 27 | } 28 | } 29 | 30 | public void Validate(ServiceEndpoint endpoint) 31 | { 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidationWithSoap/ValidatingParameterInspector.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ServiceModel.Dispatcher; 3 | 4 | namespace ParameterValidationWithSoap 5 | { 6 | public class ValidatingParameterInspector : IParameterInspector 7 | { 8 | public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState) 9 | { 10 | } 11 | 12 | public object BeforeCall(string operationName, object[] inputs) 13 | { 14 | foreach (var input in inputs) 15 | { 16 | if (input != null) 17 | { 18 | ValidationContext context = new ValidationContext(input, null, null); 19 | Validator.ValidateObject(input, context, true); 20 | } 21 | } 22 | 23 | return null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidationWithSoap/ValidationAwareErrorHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ServiceModel; 4 | using System.ServiceModel.Channels; 5 | using System.ServiceModel.Dispatcher; 6 | 7 | namespace ParameterValidationWithSoap 8 | { 9 | public class ValidationAwareErrorHandler : IErrorHandler 10 | { 11 | public ValidationAwareErrorHandler() 12 | { 13 | } 14 | 15 | public bool HandleError(Exception error) 16 | { 17 | return error is ValidationException; 18 | } 19 | 20 | public void ProvideFault(Exception error, MessageVersion version, ref Message fault) 21 | { 22 | ValidationException validationException = error as ValidationException; 23 | if (validationException != null) 24 | { 25 | FaultException faultException = new FaultException("Error: " + validationException.ValidationResult.ErrorMessage); 26 | MessageFault messageFault = faultException.CreateMessageFault(); 27 | fault = Message.CreateMessage(version, messageFault, null); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /IErrorHandler/ParameterValidationWithSoap/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /InitializerSamples/GlobAwareService/GlobAwareEndpointBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Channels; 2 | using System.ServiceModel.Description; 3 | using System.ServiceModel.Dispatcher; 4 | 5 | namespace GlobAwareService 6 | { 7 | class GlobAwareEndpointBehavior : IEndpointBehavior 8 | { 9 | public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) 10 | { 11 | } 12 | 13 | public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) 14 | { 15 | } 16 | 17 | public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 18 | { 19 | foreach (DispatchOperation operation in endpointDispatcher.DispatchRuntime.Operations) 20 | { 21 | operation.CallContextInitializers.Add(new GlobAwareCallContextInitializer()); 22 | } 23 | } 24 | 25 | public void Validate(ServiceEndpoint endpoint) 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /InitializerSamples/GlobAwareService/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /InitializerSamples/InitializerSamples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GlobAwareService", "GlobAwareService\GlobAwareService.csproj", "{AEED6743-B7C5-498E-B5E4-A59FCF2DF818}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackingClients", "TrackingClients\TrackingClients.csproj", "{EC85F612-1DB2-4A84-8F29-7F0D442A5C67}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {AEED6743-B7C5-498E-B5E4-A59FCF2DF818}.Debug|x86.ActiveCfg = Debug|x86 15 | {AEED6743-B7C5-498E-B5E4-A59FCF2DF818}.Debug|x86.Build.0 = Debug|x86 16 | {AEED6743-B7C5-498E-B5E4-A59FCF2DF818}.Release|x86.ActiveCfg = Release|x86 17 | {AEED6743-B7C5-498E-B5E4-A59FCF2DF818}.Release|x86.Build.0 = Release|x86 18 | {EC85F612-1DB2-4A84-8F29-7F0D442A5C67}.Debug|x86.ActiveCfg = Debug|x86 19 | {EC85F612-1DB2-4A84-8F29-7F0D442A5C67}.Debug|x86.Build.0 = Debug|x86 20 | {EC85F612-1DB2-4A84-8F29-7F0D442A5C67}.Release|x86.ActiveCfg = Release|x86 21 | {EC85F612-1DB2-4A84-8F29-7F0D442A5C67}.Release|x86.Build.0 = Release|x86 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /InitializerSamples/TrackingClients/ClientTrackerChannelInitializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel; 3 | using System.ServiceModel.Dispatcher; 4 | 5 | namespace TrackingClients 6 | { 7 | class ClientTrackerChannelInitializer : IChannelInitializer 8 | { 9 | internal static int ConnectedClientCount = 0; 10 | 11 | public void Initialize(IClientChannel channel) 12 | { 13 | ConnectedClientCount++; 14 | Console.WriteLine("Client {0} initialized", channel.SessionId); 15 | channel.Closed += ClientDisconnected; 16 | channel.Faulted += ClientDisconnected; 17 | } 18 | 19 | static void ClientDisconnected(object sender, EventArgs e) 20 | { 21 | Console.WriteLine("Client {0} disconnected", ((IClientChannel)sender).SessionId); 22 | ConnectedClientCount--; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /InitializerSamples/TrackingClients/ClientTrackerEndpointBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Channels; 2 | using System.ServiceModel.Description; 3 | using System.ServiceModel.Dispatcher; 4 | 5 | namespace TrackingClients 6 | { 7 | class ClientTrackerEndpointBehavior : IEndpointBehavior 8 | { 9 | public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) 10 | { 11 | } 12 | 13 | public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) 14 | { 15 | } 16 | 17 | public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 18 | { 19 | endpointDispatcher.ChannelDispatcher.ChannelInitializers.Add(new ClientTrackerChannelInitializer()); 20 | } 21 | 22 | public void Validate(ServiceEndpoint endpoint) 23 | { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /InitializerSamples/TrackingClients/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /InstanceContext/SimulatedSessions/SharedSessionEndpointBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Channels; 2 | using System.ServiceModel.Description; 3 | using System.ServiceModel.Dispatcher; 4 | 5 | namespace SimulatedSessions 6 | { 7 | class SharedSessionEndpointBehavior : IEndpointBehavior 8 | { 9 | public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) 10 | { 11 | } 12 | 13 | public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) 14 | { 15 | } 16 | 17 | public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 18 | { 19 | SharedSessionInstanceContextProvider extension = new SharedSessionInstanceContextProvider(); 20 | endpointDispatcher.DispatchRuntime.InstanceContextProvider = extension; 21 | endpointDispatcher.DispatchRuntime.MessageInspectors.Add(extension); 22 | } 23 | 24 | public void Validate(ServiceEndpoint endpoint) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /InstanceContext/SimulatedSessions/SimulatedSessions.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimulatedSessions", "SimulatedSessions.csproj", "{2AB31B55-A7A2-4325-9AFC-50EB097C6784}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {2AB31B55-A7A2-4325-9AFC-50EB097C6784}.Debug|x86.ActiveCfg = Debug|x86 13 | {2AB31B55-A7A2-4325-9AFC-50EB097C6784}.Debug|x86.Build.0 = Debug|x86 14 | {2AB31B55-A7A2-4325-9AFC-50EB097C6784}.Release|x86.ActiveCfg = Release|x86 15 | {2AB31B55-A7A2-4325-9AFC-50EB097C6784}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /InstanceContext/SimulatedSessions/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/Local.testsettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | These are default test settings for a local test run. 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService.Test/AnyInstance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PricingService.Test 7 | { 8 | public class AnyInstance 9 | { 10 | public const double AnyDouble = 2.34; 11 | public const int AnyInt = 3; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService.Test/MockProductRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PricingService.Test 7 | { 8 | public class MockProductRepository : IProductRepository 9 | { 10 | Func getProductFunction; 11 | public MockProductRepository(Func getProductFunction) 12 | { 13 | this.getProductFunction = getProductFunction; 14 | } 15 | 16 | public Product GetProduct(int productId) 17 | { 18 | return this.getProductFunction.Invoke(productId); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PricingService.Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("PricingService.Test")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8d7aa6dc-fff1-4a30-9d70-d85b2bb47e5a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService/DataContracts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.Runtime.Serialization; 7 | 8 | namespace PricingService 9 | { 10 | [DataContract] 11 | public class OrderItem 12 | { 13 | [DataMember] 14 | public int ItemId { get; set; } 15 | [DataMember] 16 | public string Name { get; set; } 17 | [DataMember] 18 | public double Amount; 19 | } 20 | 21 | [DataContract] 22 | public class Product 23 | { 24 | [DataMember] 25 | public int Id { get; set; } 26 | [DataMember] 27 | public string Name { get; set; } 28 | [DataMember] 29 | public string Unit { get; set; } 30 | [DataMember] 31 | public double UnitPrice { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService/FileBasedProductRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Runtime.Serialization; 7 | using System.Runtime.Serialization.Json; 8 | 9 | namespace PricingService 10 | { 11 | public class FileBasedProductRepository : IProductRepository 12 | { 13 | private List products; 14 | 15 | public FileBasedProductRepository(string fileName) 16 | { 17 | this.LoadProducts(fileName); 18 | } 19 | 20 | public Product GetProduct(int productId) 21 | { 22 | return this.products.Where(x => x.Id == productId).FirstOrDefault(); 23 | } 24 | 25 | private void LoadProducts(string fileName) 26 | { 27 | DataContractJsonSerializer dcs = new DataContractJsonSerializer(typeof(List)); 28 | using (FileStream fs = File.OpenRead(fileName)) 29 | { 30 | this.products = (List)dcs.ReadObject(fs); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService/IPricingService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.Runtime.Serialization; 7 | 8 | namespace PricingService 9 | { 10 | [ServiceContract(SessionMode = SessionMode.Required)] 11 | public interface IPricingService 12 | { 13 | [OperationContract(IsTerminating = true)] 14 | double PriceOrder(); 15 | [OperationContract(IsInitiating = true)] 16 | void AddToCart(OrderItem item); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService/IProductRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Runtime.Serialization; 7 | using System.Runtime.Serialization.Json; 8 | 9 | namespace PricingService 10 | { 11 | public interface IProductRepository 12 | { 13 | Product GetProduct(int productId); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService/PricingService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.Runtime.Serialization; 7 | 8 | namespace PricingService 9 | { 10 | [ServiceBehavior( 11 | InstanceContextMode = InstanceContextMode.PerSession, 12 | IncludeExceptionDetailInFaults = true)] 13 | [InstanceProviderBehavior] 14 | public class PricingService : IPricingService 15 | { 16 | List cart = new List(); 17 | IProductRepository productRepository; 18 | 19 | public PricingService(IProductRepository productRepository) 20 | { 21 | this.productRepository = productRepository; 22 | } 23 | 24 | public void AddToCart(OrderItem item) 25 | { 26 | this.cart.Add(item); 27 | } 28 | 29 | public double PriceOrder() 30 | { 31 | double result = 0; 32 | foreach (var item in this.cart) 33 | { 34 | Product product = this.productRepository.GetProduct(item.ItemId); 35 | result += product.UnitPrice * item.Amount; 36 | } 37 | 38 | this.cart.Clear(); 39 | return result; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService/ProductRepositoryFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Runtime.Serialization; 7 | using System.Runtime.Serialization.Json; 8 | 9 | namespace PricingService 10 | { 11 | public class ProductRepositoryFactory 12 | { 13 | private static ProductRepositoryFactory instance; 14 | private IProductRepository repository; 15 | 16 | private ProductRepositoryFactory() { } 17 | 18 | public static ProductRepositoryFactory Instance 19 | { 20 | get 21 | { 22 | if (instance == null) 23 | { 24 | instance = new ProductRepositoryFactory(); 25 | } 26 | 27 | return instance; 28 | } 29 | } 30 | 31 | public void SetProductRepository(IProductRepository repository) 32 | { 33 | this.repository = repository; 34 | } 35 | 36 | public IProductRepository CreateProductRepository() 37 | { 38 | return this.repository; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/PricingService/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /InstanceProvider/TestableWcfServices/TestableWcfServices.vsmdi: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/ClientCredentialsEx.cs: -------------------------------------------------------------------------------- 1 | using System.IdentityModel.Selectors; 2 | using System.ServiceModel.Description; 3 | using System.ServiceModel.Dispatcher; 4 | 5 | namespace Client 6 | { 7 | class ClientCredentialsEx : ClientCredentials 8 | { 9 | ClientForm clientForm; 10 | 11 | public ClientCredentialsEx(ClientForm clientForm) 12 | : base() 13 | { 14 | this.clientForm = clientForm; 15 | } 16 | 17 | public ClientCredentialsEx(ClientCredentialsEx other, ClientForm clientForm) 18 | : base(other) 19 | { 20 | this.clientForm = clientForm; 21 | } 22 | 23 | protected override ClientCredentials CloneCore() 24 | { 25 | return new ClientCredentialsEx(this, this.clientForm); 26 | } 27 | 28 | public override void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime) 29 | { 30 | clientRuntime.InteractiveChannelInitializers.Add(new ShowCredentialsUI(this.clientForm)); 31 | base.ApplyClientBehavior(serviceEndpoint, clientRuntime); 32 | } 33 | 34 | public override SecurityTokenManager CreateSecurityTokenManager() 35 | { 36 | return new MyClientCredentialsSecurityTokenManager(this); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/ClientPasswordDialog.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace Client 5 | { 6 | public partial class ClientPasswordDialog : Form 7 | { 8 | private bool okSelected; 9 | private string userName; 10 | private string password; 11 | 12 | public ClientPasswordDialog() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | public bool OkSelected 18 | { 19 | get { return this.okSelected; } 20 | } 21 | 22 | public string UserName 23 | { 24 | get { return this.userName; } 25 | } 26 | 27 | public string Password 28 | { 29 | get { return this.password; } 30 | } 31 | 32 | private void btnCancel_Click(object sender, EventArgs e) 33 | { 34 | this.okSelected = false; 35 | this.userName = null; 36 | this.password = null; 37 | this.Close(); 38 | } 39 | 40 | private void btnOk_Click(object sender, EventArgs e) 41 | { 42 | this.okSelected = true; 43 | this.userName = this.txtUserName.Text; 44 | this.password = this.txtPassword.Text; 45 | this.Close(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/MyClientCredentialsSecurityTokenManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.ServiceModel.Description; 7 | using System.IdentityModel.Selectors; 8 | using System.IdentityModel.Tokens; 9 | using System.Net; 10 | using System.ServiceModel.Channels; 11 | using System.ServiceModel.Security.Tokens; 12 | 13 | namespace Client 14 | { 15 | class MyClientCredentialsSecurityTokenManager : ClientCredentialsSecurityTokenManager 16 | { 17 | public MyClientCredentialsSecurityTokenManager(ClientCredentials parent) : base(parent) { } 18 | public override SecurityTokenProvider CreateSecurityTokenProvider(SecurityTokenRequirement tokenRequirement) 19 | { 20 | if (tokenRequirement.KeyUsage == SecurityKeyUsage.Signature) 21 | { 22 | NetworkCredential token = null; 23 | ChannelParameterCollection obj; 24 | obj = (ChannelParameterCollection)tokenRequirement.Properties[ 25 | ServiceModelSecurityTokenRequirement.ChannelParametersCollectionProperty]; 26 | token = obj[0] as NetworkCredential; 27 | if (tokenRequirement.TokenType == SecurityTokenTypes.UserName) 28 | { 29 | return new MyUserNameSecurityTokenProvider(token); 30 | } 31 | } 32 | 33 | return base.CreateSecurityTokenProvider(tokenRequirement); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/MyUserNameSecurityTokenProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IdentityModel.Selectors; 3 | using System.IdentityModel.Tokens; 4 | using System.Net; 5 | 6 | namespace Client 7 | { 8 | class MyUserNameSecurityTokenProvider : SecurityTokenProvider 9 | { 10 | private NetworkCredential credentials; 11 | 12 | public MyUserNameSecurityTokenProvider(NetworkCredential credentials) 13 | { 14 | this.credentials = credentials; 15 | } 16 | 17 | protected override SecurityToken GetTokenCore(TimeSpan timeout) 18 | { 19 | return new UserNameSecurityToken(this.credentials.UserName, this.credentials.Password); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace Client 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | Application.Run(new ClientForm()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Client.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Client/Service References/ServiceReference1/Service.disco: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/InteractiveChannelInitializer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{ACDBF4EA-C3B5-4221-9B06-F9BB338B385C}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{13231D86-39FF-4551-B2B6-FB9516243621}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {ACDBF4EA-C3B5-4221-9B06-F9BB338B385C}.Debug|x86.ActiveCfg = Debug|x86 15 | {ACDBF4EA-C3B5-4221-9B06-F9BB338B385C}.Debug|x86.Build.0 = Debug|x86 16 | {ACDBF4EA-C3B5-4221-9B06-F9BB338B385C}.Release|x86.ActiveCfg = Release|x86 17 | {ACDBF4EA-C3B5-4221-9B06-F9BB338B385C}.Release|x86.Build.0 = Release|x86 18 | {13231D86-39FF-4551-B2B6-FB9516243621}.Debug|x86.ActiveCfg = Debug|x86 19 | {13231D86-39FF-4551-B2B6-FB9516243621}.Debug|x86.Build.0 = Debug|x86 20 | {13231D86-39FF-4551-B2B6-FB9516243621}.Release|x86.ActiveCfg = Release|x86 21 | {13231D86-39FF-4551-B2B6-FB9516243621}.Release|x86.Build.0 = Release|x86 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/CustomAuthorizationPolicy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IdentityModel.Claims; 4 | using System.IdentityModel.Policy; 5 | using System.Security.Principal; 6 | 7 | namespace Server 8 | { 9 | class CustomAuthorizationPolicy : IAuthorizationPolicy 10 | { 11 | string id = Guid.NewGuid().ToString(); 12 | 13 | public string Id 14 | { 15 | get { return this.id; } 16 | } 17 | 18 | public ClaimSet Issuer 19 | { 20 | get { return ClaimSet.System; } 21 | } 22 | 23 | public bool Evaluate(EvaluationContext context, ref object state) 24 | { 25 | object obj; 26 | if (!context.Properties.TryGetValue("Identities", out obj)) 27 | return false; 28 | 29 | IList identities = obj as IList; 30 | if (obj == null || identities.Count <= 0) 31 | return false; 32 | 33 | context.Properties["Principal"] = new CustomPrincipal(identities[0]); 34 | return true; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/CustomPrincipal.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Principal; 2 | 3 | namespace Server 4 | { 5 | class CustomPrincipal : IPrincipal 6 | { 7 | IIdentity identity; 8 | public CustomPrincipal(IIdentity identity) 9 | { 10 | this.identity = identity; 11 | } 12 | 13 | public IIdentity Identity 14 | { 15 | get { return this.identity; } 16 | } 17 | 18 | public bool IsInRole(string role) 19 | { 20 | return true; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/MyPasswordValidator.cs: -------------------------------------------------------------------------------- 1 | using System.IdentityModel.Selectors; 2 | using System.IdentityModel.Tokens; 3 | 4 | namespace Server 5 | { 6 | class MyPasswordValidator : UserNamePasswordValidator 7 | { 8 | public override void Validate(string userName, string password) 9 | { 10 | // Very secure password scheme 11 | if (userName != password) 12 | { 13 | throw new SecurityTokenException("Unauthorized"); 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace Server 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | Application.Run(new ServerForm()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Server.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/Service.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using System.Threading; 3 | 4 | namespace Server 5 | { 6 | [ServiceContract] 7 | public interface ICalculator 8 | { 9 | [OperationContract] 10 | int Add(int x, int y); 11 | [OperationContract] 12 | int Subtract(int x, int y); 13 | [OperationContract] 14 | int Multiply(int x, int y); 15 | [OperationContract] 16 | int Divide(int x, int y); 17 | } 18 | 19 | [ServiceBehavior(UseSynchronizationContext = false)] 20 | public class Service : ICalculator 21 | { 22 | public int Add(int x, int y) 23 | { 24 | this.UpdateServerFormUi("Add"); 25 | return x + y; 26 | } 27 | 28 | public int Subtract(int x, int y) 29 | { 30 | this.UpdateServerFormUi("Subtract"); 31 | return x - y; 32 | } 33 | 34 | public int Multiply(int x, int y) 35 | { 36 | this.UpdateServerFormUi("Multiply"); 37 | return x * y; 38 | } 39 | 40 | public int Divide(int x, int y) 41 | { 42 | this.UpdateServerFormUi("Divide"); 43 | return x / y; 44 | } 45 | 46 | private void UpdateServerFormUi(string operationName) 47 | { 48 | ServerForm.UserCalled(Thread.CurrentPrincipal.Identity.Name, operationName); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /InteractiveChannelInitializer/Server/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MessageEncoder/ChangeXmlPrefixes/CalculatorService.cs: -------------------------------------------------------------------------------- 1 | namespace ChangeXmlPrefixes 2 | { 3 | public class CalculatorService : ICalculator 4 | { 5 | public int Add(int x, int y) 6 | { 7 | return x + y; 8 | } 9 | 10 | public int Subtract(int x, int y) 11 | { 12 | return x - y; 13 | } 14 | 15 | public int Multiply(int x, int y) 16 | { 17 | return x * y; 18 | } 19 | 20 | public int Divide(int x, int y) 21 | { 22 | return x / y; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /MessageEncoder/ChangeXmlPrefixes/ChangeXmlPrefixes.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChangeXmlPrefixes", "ChangeXmlPrefixes.csproj", "{517FFFC9-2279-4ECB-B44D-29FCB7C51EAF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {517FFFC9-2279-4ECB-B44D-29FCB7C51EAF}.Debug|x86.ActiveCfg = Debug|x86 13 | {517FFFC9-2279-4ECB-B44D-29FCB7C51EAF}.Debug|x86.Build.0 = Debug|x86 14 | {517FFFC9-2279-4ECB-B44D-29FCB7C51EAF}.Release|x86.ActiveCfg = Release|x86 15 | {517FFFC9-2279-4ECB-B44D-29FCB7C51EAF}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /MessageEncoder/ChangeXmlPrefixes/ICalculator.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | 3 | namespace ChangeXmlPrefixes 4 | { 5 | [ServiceContract(Name = "ITest", Namespace = "http://service.contract.namespace")] 6 | public interface ICalculator 7 | { 8 | [OperationContract] 9 | int Add(int x, int y); 10 | 11 | [OperationContract] 12 | int Subtract(int x, int y); 13 | 14 | [OperationContract] 15 | int Multiply(int x, int y); 16 | 17 | [OperationContract] 18 | int Divide(int x, int y); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MessageEncoder/ChangeXmlPrefixes/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MessageEncoder/CompositeEncoder/CompositeEncoder.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompositeEncoder", "CompositeEncoder.csproj", "{3CBF5FE1-A74E-4651-A88D-0CDC54F8BDB6}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {3CBF5FE1-A74E-4651-A88D-0CDC54F8BDB6}.Debug|x86.ActiveCfg = Debug|x86 13 | {3CBF5FE1-A74E-4651-A88D-0CDC54F8BDB6}.Debug|x86.Build.0 = Debug|x86 14 | {3CBF5FE1-A74E-4651-A88D-0CDC54F8BDB6}.Release|x86.ActiveCfg = Release|x86 15 | {3CBF5FE1-A74E-4651-A88D-0CDC54F8BDB6}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /MessageEncoder/CompositeEncoder/Contracts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using System.ServiceModel; 4 | using System.ServiceModel.Channels; 5 | using System.Net; 6 | 7 | namespace CompositeEncoder 8 | { 9 | [DataContract] 10 | public class MyDC 11 | { 12 | [DataMember] 13 | public string Name; 14 | [DataMember] 15 | public byte[] Contents; 16 | } 17 | 18 | [ServiceContract] 19 | public interface ITest 20 | { 21 | [OperationContract] 22 | MyDC Echo(MyDC input); 23 | } 24 | 25 | public class Service : ITest 26 | { 27 | public MyDC Echo(MyDC input) 28 | { 29 | HttpRequestMessageProperty requestProperty; 30 | requestProperty = (HttpRequestMessageProperty)OperationContext.Current.IncomingMessageProperties[HttpRequestMessageProperty.Name]; 31 | Console.WriteLine("In service, incoming content-type = {0}", requestProperty.Headers[HttpRequestHeader.ContentType]); 32 | return input; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /MessageEncoder/CompositeEncoder/MyReadMtomWriteXmlEncoderFactory.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Channels; 2 | 3 | namespace CompositeEncoder 4 | { 5 | class MyReadMtomWriteXmlEncoderFactory : MessageEncoderFactory 6 | { 7 | MessageEncoderFactory mtom; 8 | MessageEncoderFactory text; 9 | 10 | public MyReadMtomWriteXmlEncoderFactory(MessageEncoderFactory mtom, MessageEncoderFactory text) 11 | { 12 | this.mtom = mtom; 13 | this.text = text; 14 | } 15 | 16 | public override MessageEncoder Encoder 17 | { 18 | get { return new MyReadMtomWriteXmlEncoder(this.mtom.Encoder, this.text.Encoder); } 19 | } 20 | 21 | public override MessageVersion MessageVersion 22 | { 23 | get { return this.mtom.MessageVersion; } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MessageEncoder/CompositeEncoder/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MessageEncoder/GZipEncoderAndAutoFormatSelection/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /MessageEncoder/GZipEncoderAndAutoFormatSelection/GZipEncoderAndAutoFormatSelection.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GZipEncoderAndAutoFormatSelection", "GZipEncoderAndAutoFormatSelection.csproj", "{C08A5E90-14AB-4E21-A400-EF6807AA1C67}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C08A5E90-14AB-4E21-A400-EF6807AA1C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C08A5E90-14AB-4E21-A400-EF6807AA1C67}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C08A5E90-14AB-4E21-A400-EF6807AA1C67}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {C08A5E90-14AB-4E21-A400-EF6807AA1C67}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /MessageEncoder/GZipEncoderAndAutoFormatSelection/Service.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel; 3 | using System.Runtime.Serialization; 4 | using System.ServiceModel; 5 | using System.ServiceModel.Web; 6 | 7 | namespace GZipEncoderAndAutoFormatSelection 8 | { 9 | [DataContract(Name = "DataObject", Namespace = "")] 10 | public class DataObject : IExtensibleDataObject 11 | { 12 | [DataMember] 13 | public string Name { get; set; } 14 | 15 | [DataMember] 16 | public string Description { get; set; } 17 | 18 | [DataMember] 19 | public int UID { get; set; } 20 | 21 | public ExtensionDataObject ExtensionData { get; set; } 22 | } 23 | 24 | [ServiceContract] 25 | public interface ITest 26 | { 27 | [OperationContract] 28 | [Description("Gets a collection of objects.")] 29 | [WebGet(UriTemplate = "Objects")] 30 | List GetObjects(); 31 | 32 | [OperationContract] 33 | [Description("Adds a new Object")] 34 | [WebInvoke(Method = "POST", UriTemplate = "Objects")] 35 | void PostObject(DataObject o); 36 | } 37 | 38 | public class Service : ITest 39 | { 40 | protected static List data = new List(); 41 | 42 | public List GetObjects() 43 | { 44 | return data; 45 | } 46 | 47 | public void PostObject(DataObject o) 48 | { 49 | data.Add(o); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /MessageFormatter/MessageFormatter/JsonNetMessageFormatter/ITestService.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel; 2 | using System.ServiceModel.Web; 3 | 4 | namespace JsonNetMessageFormatter 5 | { 6 | [ServiceContract] 7 | public interface ITestService 8 | { 9 | [WebGet, OperationContract] 10 | Person GetPerson(); 11 | [WebInvoke, OperationContract] 12 | Pet EchoPet(Pet pet); 13 | [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest), OperationContract] 14 | int Add(int x, int y); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /MessageFormatter/MessageFormatter/JsonNetMessageFormatter/RawBodyWriter.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Channels; 2 | using System.Xml; 3 | 4 | namespace JsonNetMessageFormatter 5 | { 6 | class RawBodyWriter : BodyWriter 7 | { 8 | byte[] content; 9 | public RawBodyWriter(byte[] content) 10 | : base(true) 11 | { 12 | this.content = content; 13 | } 14 | 15 | protected override void OnWriteBodyContents(XmlDictionaryWriter writer) 16 | { 17 | writer.WriteStartElement("Binary"); 18 | writer.WriteBase64(content, 0, content.Length); 19 | writer.WriteEndElement(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MessageFormatter/MessageFormatter/JsonNetMessageFormatter/Service.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace JsonNetMessageFormatter 5 | { 6 | public class Service : ITestService 7 | { 8 | public Person GetPerson() 9 | { 10 | return new Person 11 | { 12 | FirstName = "First", 13 | LastName = "Last", 14 | BirthDate = new DateTime(1993, 4, 17, 2, 51, 37, 47, DateTimeKind.Local), 15 | Id = 0, 16 | Pets = new List 17 | { 18 | new Pet { Name= "Generic Pet 1", Color = "Beige", Id = 0, Markings = "Some markings" }, 19 | new Pet { Name= "Generic Pet 2", Color = "Gold", Id = 0, Markings = "Other markings" }, 20 | }, 21 | }; 22 | } 23 | 24 | public Pet EchoPet(Pet pet) 25 | { 26 | return pet; 27 | } 28 | 29 | public int Add(int x, int y) 30 | { 31 | return x + y; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MessageFormatter/MessageFormatter/JsonNetMessageFormatter/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MessageFormatter/MessageFormatter/MessageFormatter.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonNetMessageFormatter", "JsonNetMessageFormatter\JsonNetMessageFormatter.csproj", "{3C8DF9B5-BECF-4EC0-AA12-C9C78173E6BE}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {3C8DF9B5-BECF-4EC0-AA12-C9C78173E6BE}.Debug|x86.ActiveCfg = Debug|x86 13 | {3C8DF9B5-BECF-4EC0-AA12-C9C78173E6BE}.Debug|x86.Build.0 = Debug|x86 14 | {3C8DF9B5-BECF-4EC0-AA12-C9C78173E6BE}.Release|x86.ActiveCfg = Release|x86 15 | {3C8DF9B5-BECF-4EC0-AA12-C9C78173E6BE}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /MessageFormatter/MessageFormatter/lib/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/carlosfigueira/WCFSamples/d490563ed37b41433ffb5c5c0820c2a861ef319b/MessageFormatter/MessageFormatter/lib/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /MessageFormatter/PerOperationContentTypeMapper/DualModeWebHttpBehavior.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.ServiceModel.Web; 7 | using System.IO; 8 | using System.ServiceModel.Channels; 9 | using System.ServiceModel.Description; 10 | using System.ServiceModel.Dispatcher; 11 | using System.Net; 12 | 13 | namespace PerOperationContentTypeMapper 14 | { 15 | public class DualModeWebHttpBehavior : WebHttpBehavior 16 | { 17 | protected override IDispatchMessageFormatter GetRequestDispatchFormatter(OperationDescription operationDescription, ServiceEndpoint endpoint) 18 | { 19 | IDispatchMessageFormatter originalFormatter = base.GetRequestDispatchFormatter(operationDescription, endpoint); 20 | return new DualModeFormatter(operationDescription, originalFormatter); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MessageFormatter/PerOperationContentTypeMapper/NonRawAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.ServiceModel.Web; 7 | using System.IO; 8 | using System.ServiceModel.Channels; 9 | using System.ServiceModel.Description; 10 | using System.ServiceModel.Dispatcher; 11 | using System.Net; 12 | 13 | namespace PerOperationContentTypeMapper 14 | { 15 | public class NonRawAttribute : Attribute, IOperationBehavior 16 | { 17 | public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters) 18 | { 19 | } 20 | 21 | public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation) 22 | { 23 | } 24 | 25 | public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) 26 | { 27 | } 28 | 29 | public void Validate(OperationDescription operationDescription) 30 | { 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /MessageFormatter/PerOperationContentTypeMapper/PerOperationContentTypeMapper.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerOperationContentTypeMapper", "PerOperationContentTypeMapper.csproj", "{5A2EF653-22D8-4200-B821-84A7425D1037}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {5A2EF653-22D8-4200-B821-84A7425D1037}.Debug|x86.ActiveCfg = Debug|x86 13 | {5A2EF653-22D8-4200-B821-84A7425D1037}.Debug|x86.Build.0 = Debug|x86 14 | {5A2EF653-22D8-4200-B821-84A7425D1037}.Release|x86.ActiveCfg = Release|x86 15 | {5A2EF653-22D8-4200-B821-84A7425D1037}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /MessageFormatter/PerOperationContentTypeMapper/RawContentTypeMapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.ServiceModel.Web; 7 | using System.IO; 8 | using System.ServiceModel.Channels; 9 | using System.ServiceModel.Description; 10 | using System.ServiceModel.Dispatcher; 11 | using System.Net; 12 | 13 | namespace PerOperationContentTypeMapper 14 | { 15 | class RawContentTypeMapper : WebContentTypeMapper 16 | { 17 | public override WebContentFormat GetMessageFormatForContentType(string contentType) 18 | { 19 | return WebContentFormat.Raw; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MessageFormatter/PerOperationContentTypeMapper/Service.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.ServiceModel; 6 | using System.ServiceModel.Web; 7 | using System.IO; 8 | using System.ServiceModel.Channels; 9 | using System.ServiceModel.Description; 10 | using System.ServiceModel.Dispatcher; 11 | using System.Net; 12 | 13 | namespace PerOperationContentTypeMapper 14 | { 15 | [ServiceContract] 16 | public class Service 17 | { 18 | [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest)] 19 | [NonRaw] 20 | public int Add(int x, int y) 21 | { 22 | return x + y; 23 | } 24 | 25 | [WebInvoke] 26 | public string Upload(Stream data) 27 | { 28 | return new StreamReader(data).ReadToEnd(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MessageFormatter/PerOperationContentTypeMapper/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MessageInspector/InspectNonXmlMessages/InspectNonXmlMessages.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C# Express 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InspectNonXmlMessages", "InspectNonXmlMessages.csproj", "{B933DA5F-6BF0-471E-9DFC-68621C1111A1}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {B933DA5F-6BF0-471E-9DFC-68621C1111A1}.Debug|x86.ActiveCfg = Debug|x86 13 | {B933DA5F-6BF0-471E-9DFC-68621C1111A1}.Debug|x86.Build.0 = Debug|x86 14 | {B933DA5F-6BF0-471E-9DFC-68621C1111A1}.Release|x86.ActiveCfg = Release|x86 15 | {B933DA5F-6BF0-471E-9DFC-68621C1111A1}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /MessageInspector/InspectNonXmlMessages/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /OperationInvoker/CachingOperationInvoker/CacheableOperationAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel.Channels; 3 | using System.ServiceModel.Description; 4 | using System.ServiceModel.Dispatcher; 5 | 6 | namespace OperationSelectorExample 7 | { 8 | public class CacheableOperationAttribute : Attribute, IOperationBehavior 9 | { 10 | double secondsToCache; 11 | public CacheableOperationAttribute() 12 | { 13 | this.secondsToCache = 30; 14 | } 15 | 16 | public double SecondsToCache 17 | { 18 | get { return this.secondsToCache; } 19 | set { this.secondsToCache = value; } 20 | } 21 | 22 | public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters) 23 | { 24 | } 25 | 26 | public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation) 27 | { 28 | } 29 | 30 | public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) 31 | { 32 | dispatchOperation.Invoker = new CachingOperationInvoker(dispatchOperation.Invoker, this.secondsToCache); 33 | } 34 | 35 | public void Validate(OperationDescription operationDescription) 36 | { 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /OperationInvoker/CachingOperationInvoker/CachingOperationInvoker.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CachingOperationInvoker", "CachingOperationInvoker.csproj", "{4FD4988A-06E7-4CC7-82A4-79B203137A15}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4FD4988A-06E7-4CC7-82A4-79B203137A15}.Debug|x86.ActiveCfg = Debug|x86 13 | {4FD4988A-06E7-4CC7-82A4-79B203137A15}.Debug|x86.Build.0 = Debug|x86 14 | {4FD4988A-06E7-4CC7-82A4-79B203137A15}.Release|x86.ActiveCfg = Release|x86 15 | {4FD4988A-06E7-4CC7-82A4-79B203137A15}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /OperationInvoker/CachingOperationInvoker/Interface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel; 3 | 4 | namespace OperationSelectorExample 5 | { 6 | [ServiceContract] 7 | public interface ITest 8 | { 9 | [OperationContract] 10 | int Add(int x, int y); 11 | 12 | [OperationContract] 13 | [CacheableOperation(SecondsToCache = 10)] 14 | string Reverse(string input); 15 | 16 | [OperationContract(AsyncPattern=true)] 17 | [CacheableOperation(SecondsToCache = 30)] 18 | IAsyncResult BeginPower(double x, double y, AsyncCallback callback, object state); 19 | double EndPower(IAsyncResult asyncResult); 20 | 21 | [OperationContract, CacheableOperation] 22 | bool TryParseInt(string input, out int value); 23 | 24 | [OperationContract(AsyncPattern = true), CacheableOperation] 25 | IAsyncResult BeginTryParseDouble(string input, AsyncCallback callback, object state); 26 | bool EndTryParseDouble(out double value, IAsyncResult asyncResult); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /OperationInvoker/CachingOperationInvoker/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /OperationSelector/HttpMethodOverrideOperationSelection/HttpMethodOverrideOperationSelection.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HttpMethodOverrideOperationSelection", "HttpMethodOverrideOperationSelection.csproj", "{DD26848E-F3BD-4940-81FF-621434801FAE}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {DD26848E-F3BD-4940-81FF-621434801FAE}.Debug|x86.ActiveCfg = Debug|x86 13 | {DD26848E-F3BD-4940-81FF-621434801FAE}.Debug|x86.Build.0 = Debug|x86 14 | {DD26848E-F3BD-4940-81FF-621434801FAE}.Release|x86.ActiveCfg = Release|x86 15 | {DD26848E-F3BD-4940-81FF-621434801FAE}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /OperationSelector/HttpMethodOverrideOperationSelection/HttpOverrideBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Channels; 2 | using System.ServiceModel.Description; 3 | using System.ServiceModel.Dispatcher; 4 | 5 | namespace HttpMethodOverrideOperationSelection 6 | { 7 | public class HttpOverrideBehavior : IEndpointBehavior 8 | { 9 | public const string HttpMethodOverrideHeaderName = "X-HTTP-Method-Override"; 10 | public const string OriginalHttpMethodPropertyName = "OriginalHttpMethod"; 11 | 12 | public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) 13 | { 14 | } 15 | 16 | public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) 17 | { 18 | } 19 | 20 | public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 21 | { 22 | endpointDispatcher.DispatchRuntime.OperationSelector = new HttpOverrideOperationSelector(endpointDispatcher.DispatchRuntime.OperationSelector); 23 | } 24 | 25 | public void Validate(ServiceEndpoint endpoint) 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /OperationSelector/HttpMethodOverrideOperationSelection/HttpOverrideOperationSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel.Channels; 3 | using System.ServiceModel.Dispatcher; 4 | 5 | namespace HttpMethodOverrideOperationSelection 6 | { 7 | class HttpOverrideOperationSelector : IDispatchOperationSelector 8 | { 9 | private IDispatchOperationSelector originalSelector; 10 | 11 | public HttpOverrideOperationSelector(IDispatchOperationSelector originalSelector) 12 | { 13 | this.originalSelector = originalSelector; 14 | } 15 | 16 | public string SelectOperation(ref Message message) 17 | { 18 | if (message.Properties.ContainsKey(HttpRequestMessageProperty.Name)) 19 | { 20 | HttpRequestMessageProperty reqProp; 21 | reqProp = (HttpRequestMessageProperty)message.Properties[HttpRequestMessageProperty.Name]; 22 | string httpMethodOverride = reqProp.Headers[HttpOverrideBehavior.HttpMethodOverrideHeaderName]; 23 | if (!String.IsNullOrEmpty(httpMethodOverride)) 24 | { 25 | message.Properties[HttpOverrideBehavior.OriginalHttpMethodPropertyName] = reqProp.Method; 26 | reqProp.Method = httpMethodOverride; 27 | } 28 | } 29 | 30 | return this.originalSelector.SelectOperation(ref message); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /OperationSelector/HttpMethodOverrideOperationSelection/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Those are samples which I've posted in the MSDN Code Gallery, at 2 | http://code.msdn.microsoft.com/site/search?f[0].Type=User&f[0].Value=CarlosFigueira, 3 | along with some additional code not in the sample (for example, some additional 4 | projects I used to answer some questions in the associated posts. 5 | 6 | -------------------------------------------------------------------------------- /Scenarios/CORS/CORS.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CorsEnabledService", "CorsEnabledService\CorsEnabledService.csproj", "{E37581A8-6A34-4EFF-B82A-9CE85B6F8571}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MashupApp", "MashupApp\MashupApp.csproj", "{8C0F330C-89F9-4CAD-B94C-45F32CE5374E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E37581A8-6A34-4EFF-B82A-9CE85B6F8571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {E37581A8-6A34-4EFF-B82A-9CE85B6F8571}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {E37581A8-6A34-4EFF-B82A-9CE85B6F8571}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {E37581A8-6A34-4EFF-B82A-9CE85B6F8571}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {8C0F330C-89F9-4CAD-B94C-45F32CE5374E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {8C0F330C-89F9-4CAD-B94C-45F32CE5374E}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {8C0F330C-89F9-4CAD-B94C-45F32CE5374E}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {8C0F330C-89F9-4CAD-B94C-45F32CE5374E}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/CorsConstants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace CorsEnabledService 4 | { 5 | class CorsConstants 6 | { 7 | internal const string Origin = "Origin"; 8 | internal const string AccessControlAllowOrigin = "Access-Control-Allow-Origin"; 9 | internal const string AccessControlRequestMethod = "Access-Control-Request-Method"; 10 | internal const string AccessControlRequestHeaders = "Access-Control-Request-Headers"; 11 | internal const string AccessControlAllowMethods = "Access-Control-Allow-Methods"; 12 | internal const string AccessControlAllowHeaders = "Access-Control-Allow-Headers"; 13 | 14 | internal const string PreflightSuffix = "_preflight_"; 15 | } 16 | } -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/CorsEnabledAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ServiceModel.Channels; 3 | using System.ServiceModel.Description; 4 | using System.ServiceModel.Dispatcher; 5 | 6 | namespace CorsEnabledService 7 | { 8 | public class CorsEnabledAttribute : Attribute, IOperationBehavior 9 | { 10 | public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters) 11 | { 12 | } 13 | 14 | public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation) 15 | { 16 | } 17 | 18 | public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) 19 | { 20 | } 21 | 22 | public void Validate(OperationDescription operationDescription) 23 | { 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/EnableCorsEndpointBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.ServiceModel.Channels; 4 | using System.ServiceModel.Description; 5 | using System.ServiceModel.Dispatcher; 6 | 7 | namespace CorsEnabledService 8 | { 9 | class EnableCorsEndpointBehavior : IEndpointBehavior 10 | { 11 | public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) 12 | { 13 | } 14 | 15 | public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) 16 | { 17 | } 18 | 19 | public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) 20 | { 21 | List corsEnabledOperations = endpoint.Contract.Operations 22 | .Where(o => o.Behaviors.Find() != null) 23 | .ToList(); 24 | endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new CorsEnabledMessageInspector(corsEnabledOperations)); 25 | } 26 | 27 | public void Validate(ServiceEndpoint endpoint) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="CorsEnabledService.Global" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Security; 6 | using System.Web.SessionState; 7 | using System.Web.Routing; 8 | using System.ServiceModel.Activation; 9 | 10 | namespace CorsEnabledService 11 | { 12 | public class Global : System.Web.HttpApplication 13 | { 14 | 15 | protected void Application_Start(object sender, EventArgs e) 16 | { 17 | RouteTable.Routes.Add(new ServiceRoute("api", new CorsEnabledServiceHostFactory(), typeof(ValuesService))); 18 | } 19 | 20 | protected void Session_Start(object sender, EventArgs e) 21 | { 22 | 23 | } 24 | 25 | protected void Application_BeginRequest(object sender, EventArgs e) 26 | { 27 | 28 | } 29 | 30 | protected void Application_AuthenticateRequest(object sender, EventArgs e) 31 | { 32 | 33 | } 34 | 35 | protected void Application_Error(object sender, EventArgs e) 36 | { 37 | 38 | } 39 | 40 | protected void Session_End(object sender, EventArgs e) 41 | { 42 | 43 | } 44 | 45 | protected void Application_End(object sender, EventArgs e) 46 | { 47 | 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/IValues.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Serialization; 5 | using System.ServiceModel; 6 | using System.Text; 7 | using System.ServiceModel.Web; 8 | 9 | namespace CorsEnabledService 10 | { 11 | [ServiceContract] 12 | public interface IValues 13 | { 14 | [WebGet(UriTemplate = "values", ResponseFormat = WebMessageFormat.Json), CorsEnabled] 15 | List GetValues(); 16 | [WebGet(UriTemplate = "values/{id}", ResponseFormat = WebMessageFormat.Json), CorsEnabled] 17 | string GetValue(string id); 18 | [WebInvoke(UriTemplate = "/values", Method = "POST", ResponseFormat = WebMessageFormat.Json), CorsEnabled] 19 | void AddValue(string value); 20 | [WebInvoke(UriTemplate = "/values/{id}", Method = "DELETE", ResponseFormat = WebMessageFormat.Json), CorsEnabled] 21 | void DeleteValue(string id); 22 | [WebInvoke(UriTemplate = "/values/{id}", Method = "PUT", ResponseFormat = WebMessageFormat.Json), CorsEnabled] 23 | string UpdateValue(string id, string value); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/PreflightOperationBehavior.cs: -------------------------------------------------------------------------------- 1 | using System.ServiceModel.Channels; 2 | using System.ServiceModel.Description; 3 | using System.ServiceModel.Dispatcher; 4 | using System.Collections.Generic; 5 | 6 | namespace CorsEnabledService 7 | { 8 | class PreflightOperationBehavior : IOperationBehavior 9 | { 10 | private OperationDescription preflightOperation; 11 | private List allowedMethods; 12 | 13 | public PreflightOperationBehavior(OperationDescription preflightOperation) 14 | { 15 | this.preflightOperation = preflightOperation; 16 | this.allowedMethods = new List(); 17 | } 18 | 19 | public void AddAllowedMethod(string httpMethod) 20 | { 21 | this.allowedMethods.Add(httpMethod); 22 | } 23 | 24 | public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters) 25 | { 26 | } 27 | 28 | public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation) 29 | { 30 | } 31 | 32 | public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation) 33 | { 34 | dispatchOperation.Invoker = new PreflightOperationInvoker(operationDescription.Messages[1].Action, this.allowedMethods); 35 | } 36 | 37 | public void Validate(OperationDescription operationDescription) 38 | { 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CorsEnabledService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CorsEnabledService")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7804dad6-45f6-401c-971d-b14eb2366412")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Scenarios/CORS/CorsEnabledService/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Scenarios/CORS/MashupApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MashupApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MashupApp")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f09d3b10-92cd-4d33-b9da-7faa70e48a86")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Scenarios/CORS/MashupApp/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Scenarios/CORS/MashupApp/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Scenarios/CORS/MashupApp/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/JsonClient.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SLApp", "SLApp\SLApp.csproj", "{0FDEEBA0-1E86-41D7-957D-048B9AA76EC2}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SLApp.Web", "SLApp.Web\SLApp.Web.csproj", "{02DA7756-BD50-4BA3-A681-4345D8738803}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {0FDEEBA0-1E86-41D7-957D-048B9AA76EC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {0FDEEBA0-1E86-41D7-957D-048B9AA76EC2}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {0FDEEBA0-1E86-41D7-957D-048B9AA76EC2}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {0FDEEBA0-1E86-41D7-957D-048B9AA76EC2}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {02DA7756-BD50-4BA3-A681-4345D8738803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {02DA7756-BD50-4BA3-A681-4345D8738803}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {02DA7756-BD50-4BA3-A681-4345D8738803}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {02DA7756-BD50-4BA3-A681-4345D8738803}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SLApp.Web")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("SLApp.Web")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f9da8457-d3d6-4da6-806c-641ebd203db0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp.Web/RestService.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="SLApp.Web.RestService" CodeBehind="RestService.svc.cs" %> 2 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp.Web/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Silverlight/JsonClient/SLApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SLApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("SLApp")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("65529901-a156-43c3-882e-db2f3e2704b9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp.Web/IWcfDownloadService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | #if SILVERLIGHT 4 | using System.Runtime.Serialization; 5 | #endif 6 | using System.ServiceModel; 7 | #if !SILVERLIGHT 8 | using System.ServiceModel.Activation; 9 | #endif 10 | using System.ServiceModel.Channels; 11 | 12 | namespace SLApp.Web 13 | { 14 | [ServiceContract(Namespace = "")] 15 | public interface IWcfDownloadService 16 | { 17 | #if !SILVERLIGHT 18 | [OperationContract(Action = Constants.DownloadAction, ReplyAction = Constants.DownloadReplyAction)] 19 | Stream Download(string fileName, long fileSize); 20 | #else 21 | [OperationContract(AsyncPattern = true, Action = Constants.DownloadAction, ReplyAction = Constants.DownloadReplyAction)] 22 | IAsyncResult BeginDownload(Message request, AsyncCallback callback, object state); 23 | Message EndDownload(IAsyncResult asyncResult); 24 | #endif 25 | } 26 | 27 | public static class Constants 28 | { 29 | public const string DownloadAction = "http://my.company.com/download"; 30 | public const string DownloadReplyAction = "http://my.company.com/download"; 31 | } 32 | 33 | #if SILVERLIGHT 34 | [DataContract(Name = "Download", Namespace = "")] // same namespace as the [ServiceContract], same name as operation 35 | public class DownloadRequest 36 | { 37 | [DataMember(Order = 1)] 38 | public string fileName; 39 | [DataMember(Order = 2)] 40 | public long fileSize; 41 | } 42 | #endif 43 | } 44 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SLApp.Web")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("SLApp.Web")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7545f2a0-40e8-4b8f-aacf-2c5992629fce")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp.Web/WcfDownloadService.svc: -------------------------------------------------------------------------------- 1 | <%@ ServiceHost Language="C#" Debug="true" Service="SLApp.Web.WcfDownloadService" CodeBehind="WcfDownloadService.svc.cs" %> 2 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp.Web/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp.Web/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp.Web/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Silverlight/StreamedResponses/SLApp/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |