Changeset 170
- Timestamp:
- Feb 3, 2013, 9:12:25 AM (11 years ago)
- Location:
- trunk/Utilities/Miscellaneous/WcfRest01
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/Miscellaneous/WcfRest01/Client/Client.csproj
r169 r170 12 12 <AssemblyName>Client</AssemblyName> 13 13 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 14 <TargetFrameworkProfile>Client</TargetFrameworkProfile> 14 <TargetFrameworkProfile> 15 </TargetFrameworkProfile> 15 16 <FileAlignment>512</FileAlignment> 16 17 </PropertyGroup> … … 39 40 <Reference Include="System.Runtime.Serialization" /> 40 41 <Reference Include="System.ServiceModel" /> 42 <Reference Include="System.ServiceModel.Web" /> 41 43 <Reference Include="System.Xml.Linq" /> 42 44 <Reference Include="System.Data.DataSetExtensions" /> … … 48 50 <Compile Include="Program.cs" /> 49 51 <Compile Include="Properties\AssemblyInfo.cs" /> 50 <Compile Include="Service References\ServerServiceReference\Reference.cs">51 <AutoGen>True</AutoGen>52 <DesignTime>True</DesignTime>53 <DependentUpon>Reference.svcmap</DependentUpon>54 </Compile>55 52 </ItemGroup> 56 53 <ItemGroup> … … 59 56 <ItemGroup> 60 57 <None Include="app.config" /> 61 <None Include="Service References\ServerServiceReference\item.xsd">62 <SubType>Designer</SubType>63 </None>64 <None Include="Service References\ServerServiceReference\item1.xsd">65 <SubType>Designer</SubType>66 </None>67 <None Include="Service References\ServerServiceReference\Service.wsdl" />68 </ItemGroup>69 <ItemGroup>70 <WCFMetadataStorage Include="Service References\ServerServiceReference\" />71 </ItemGroup>72 <ItemGroup>73 <None Include="Service References\ServerServiceReference\configuration91.svcinfo" />74 </ItemGroup>75 <ItemGroup>76 <None Include="Service References\ServerServiceReference\configuration.svcinfo" />77 </ItemGroup>78 <ItemGroup>79 <None Include="Service References\ServerServiceReference\Reference.svcmap">80 <Generator>WCF Proxy Generator</Generator>81 <LastGenOutput>Reference.cs</LastGenOutput>82 </None>83 58 </ItemGroup> 84 59 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/Utilities/Miscellaneous/WcfRest01/Client/Program.cs
r169 r170 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Collections.Specialized; 3 4 using System.Linq; 4 5 using System.Text; … … 7 8 using System.ServiceModel; 8 9 using System.ServiceModel.Description; 10 using System.ServiceModel.Web; 9 11 10 12 namespace Client 11 13 { 14 [ServiceContract] 15 public interface IService 16 { 17 [OperationContract] 18 [WebGet(UriTemplate = "/Method?input={input}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)] 19 string Method(string input); 20 } 21 22 public partial class ServiceClient : 23 ClientBase<IService>, 24 IService 25 { 26 public ServiceClient() 27 { 28 } 29 public ServiceClient(string endpointConfigurationName) : 30 base(endpointConfigurationName) 31 { 32 } 33 public ServiceClient(string endpointConfigurationName, string remoteAddress) : 34 base(endpointConfigurationName, remoteAddress) 35 { 36 } 37 public ServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress) : 38 base(endpointConfigurationName, remoteAddress) 39 { 40 } 41 public ServiceClient(System.ServiceModel.Channels.Binding binding, EndpointAddress remoteAddress) : 42 base(binding, remoteAddress) 43 { 44 } 45 46 #region IService 47 public string Method(string input) 48 { 49 return base.Channel.Method(input); 50 } 51 #endregion 52 } 53 12 54 class Program 13 55 { 14 static void Main(string[] args)56 static void NonRestMain() 15 57 { 16 Thread.Sleep(1000); 17 ServerServiceReference.ServiceClient client = new ServerServiceReference.ServiceClient(); 58 //ServerServiceReference.ServiceClient client = new ServerServiceReference.ServiceClient(); 59 //for (int iteration = 0; ; iteration++) 60 //{ 61 // string input = char.ConvertFromUtf32('A' + (iteration / 10)) + (iteration % 10).ToString(); 62 // string output = client.Method(input); 63 // Console.WriteLine(string.Format("Request sent/received, input {0}, output {1}", input, output)); 64 // Thread.Sleep(2 * 1000); 65 //} 66 } 67 static void RestMain() 68 { 69 ServiceClient client = new ServiceClient(); 18 70 for (int iteration = 0; ; iteration++) 19 71 { … … 24 76 } 25 77 } 78 static void Main(string[] args) 79 { 80 #if DEBUG 81 Thread.Sleep(1000); 82 #endif 83 //NonRestMain(); 84 RestMain(); 85 } 26 86 } 27 87 } -
trunk/Utilities/Miscellaneous/WcfRest01/Client/app.config
r169 r170 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0"?> 2 2 <configuration> 3 <startup> 4 <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 5 </startup> 3 6 <system.serviceModel> 4 <bindings>5 <basicHttpBinding>6 <binding name="BasicHttpBinding_IService" />7 </basicHttpBinding>8 </bindings>9 7 <client> 10 <endpoint address="http://localhost:999/Service" binding="basicHttpBinding" 11 bindingConfiguration="BasicHttpBinding_IService" contract="ServerServiceReference.IService" 12 name="BasicHttpBinding_IService" /> 8 <endpoint name="rest" address="http://localhost:999/Service" binding="webHttpBinding" behaviorConfiguration="defaultBehaviorConfiguration" contract="Client.IService" /> 13 9 </client> 10 <bindings/> 11 <behaviors> 12 <endpointBehaviors> 13 <behavior name="defaultBehaviorConfiguration"> 14 <webHttp/> 15 </behavior> 16 </endpointBehaviors> 17 </behaviors> 14 18 </system.serviceModel> 15 19 </configuration> -
trunk/Utilities/Miscellaneous/WcfRest01/Server/Program.cs
r169 r170 7 7 using System.ServiceModel; 8 8 using System.ServiceModel.Description; 9 using System.ServiceModel.Web; 9 10 10 11 namespace Server … … 14 15 { 15 16 [OperationContract] 17 [WebGet(UriTemplate = "/Method?input={input}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)] 16 18 string Method(string input); 17 19 } -
trunk/Utilities/Miscellaneous/WcfRest01/Server/Server.csproj
r169 r170 51 51 </ItemGroup> 52 52 <ItemGroup> 53 <None Include="app.config" /> 53 <None Include="app.config"> 54 <SubType>Designer</SubType> 55 </None> 54 56 </ItemGroup> 55 57 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/Utilities/Miscellaneous/WcfRest01/Server/app.config
r169 r170 7 7 <services> 8 8 <service name="Server.Service" behaviorConfiguration="defaultServiceBehavior"> 9 <endpoint contract="Server.IService" address="Service" binding=" basicHttpBinding" behaviorConfiguration="defaultEndpointBehavior"/>9 <endpoint contract="Server.IService" address="Service" binding="webHttpBinding" behaviorConfiguration="restEndpointBehavior"/> 10 10 <host> 11 11 <baseAddresses> … … 19 19 <binding name="defaultBinding"/> 20 20 </basicHttpBinding> 21 <webHttpBinding> 22 </webHttpBinding> 21 23 </bindings> 22 24 <behaviors> … … 30 32 <behavior name="defaultEndpointBehavior"> 31 33 </behavior> 34 <behavior name="restEndpointBehavior"> 35 <webHttp/> 36 </behavior> 32 37 </endpointBehaviors> 33 38 </behaviors> -
trunk/Utilities/Miscellaneous/WcfRest01/WcfRest01.sln
r169 r170 5 5 EndProject 6 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{E9D0A60F-B9D3-4C07-931E-FCBBE5057DFB}" 7 ProjectSection(ProjectDependencies) = postProject 8 {CA3B4729-47B2-419C-9EF0-146539E3CAC6} = {CA3B4729-47B2-419C-9EF0-146539E3CAC6} 9 EndProjectSection 7 10 EndProject 8 11 Global
Note: See TracChangeset
for help on using the changeset viewer.