Skip to content

Commit

Permalink
services found
Browse files Browse the repository at this point in the history
  • Loading branch information
shishkin committed May 28, 2010
1 parent cb831b2 commit 9c68c14
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 0 deletions.
12 changes: 12 additions & 0 deletions DotNetCologne.Samples.sln
Expand Up @@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleService", "SimpleServ
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetWebService", "AspNetWebService\AspNetWebService.csproj", "{F7862B86-8635-4435-94E2-90D60A90D548}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleClient", "SimpleClient\SimpleClient.csproj", "{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -35,6 +37,16 @@ Global
{F7862B86-8635-4435-94E2-90D60A90D548}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F7862B86-8635-4435-94E2-90D60A90D548}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F7862B86-8635-4435-94E2-90D60A90D548}.Release|x86.ActiveCfg = Release|Any CPU
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Debug|Any CPU.ActiveCfg = Debug|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Debug|Mixed Platforms.Build.0 = Debug|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Debug|x86.ActiveCfg = Debug|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Debug|x86.Build.0 = Debug|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Release|Any CPU.ActiveCfg = Release|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Release|Mixed Platforms.ActiveCfg = Release|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Release|Mixed Platforms.Build.0 = Release|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Release|x86.ActiveCfg = Release|x86
{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
34 changes: 34 additions & 0 deletions SimpleClient/Program.cs
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Discovery;

namespace SimpleClient
{
[ServiceContract]
public interface EchoService
{
[OperationContract]
string Echo(string text);
}

class Program
{
static void Main(string[] args)
{
var discovery = new DiscoveryClient(
new UdpDiscoveryEndpoint());
var criteria = new FindCriteria(typeof(EchoService))
{
Duration = TimeSpan.FromSeconds(2)
};
var service = discovery.Find(criteria);
foreach (var endpoint in service.Endpoints)
{
Console.WriteLine("{0}", endpoint.Address);
}
}
}
}
36 changes: 36 additions & 0 deletions SimpleClient/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimpleClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("SimpleClient")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9591bc16-4ea1-4f9e-8961-d2cdfc2fc9ed")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
59 changes: 59 additions & 0 deletions SimpleClient/SimpleClient.csproj
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3ECC3979-4AF5-43F5-8BB8-9C2F83DFA4B4}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SimpleClient</RootNamespace>
<AssemblyName>SimpleClient</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Discovery" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
1 change: 1 addition & 0 deletions SimpleService/App.config
Expand Up @@ -4,6 +4,7 @@
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDiscovery />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
Expand Down
2 changes: 2 additions & 0 deletions SimpleService/Program.cs
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Discovery;

namespace SimpleService
{
Expand All @@ -28,6 +29,7 @@ static void Main(string[] args)
typeof(EchoService),
new WSHttpBinding(),
"ws");
host.AddServiceEndpoint(new UdpDiscoveryEndpoint());
host.AddDefaultEndpoints();
host.Open();

Expand Down
1 change: 1 addition & 0 deletions SimpleService/SimpleService.csproj
Expand Up @@ -37,6 +37,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Discovery" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down

0 comments on commit 9c68c14

Please sign in to comment.