Added Wcf Quickstart.

This commit is contained in:
bbaia
2008-07-07 10:19:50 +00:00
parent 074a212357
commit 5e8a094389
19 changed files with 955 additions and 0 deletions

View File

@@ -0,0 +1,129 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.ClientApp.2008", "src\Spring.WcfQuickStart.ClientApp\Spring.WcfQuickStart.ClientApp.2008.csproj", "{D58B3101-4433-49C5-B41B-51134424FC42}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "D:\...\Spring.WcfQuickStart.Web.2008\", "src\Spring.WcfQuickStart.Web.2008\", "{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}"
ProjectSection(WebsiteProperties) = preProject
ProjectReferences = "{710961A3-0DF4-49E4-A26E-F5B9C044AC84}|Spring.Core.dll;{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}|Spring.Services.dll;"
Debug.AspNetCompiler.VirtualPath = "/Spring.WcfQuickStart.Web.2008"
Debug.AspNetCompiler.PhysicalPath = "src\Spring.WcfQuickStart.Web.2008\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.WcfQuickStart.Web.2008\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/Spring.WcfQuickStart.Web.2008"
Release.AspNetCompiler.PhysicalPath = "src\Spring.WcfQuickStart.Web.2008\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\Spring.WcfQuickStart.Web.2008\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "2637"
DefaultWebSiteLanguage = "Visual C#"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.2005", "..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj", "{710961A3-0DF4-49E4-A26E-F5B9C044AC84}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Services.2008", "..\..\..\src\Spring\Spring.Services\Spring.Services.2008.csproj", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.WcfQuickStart.ServerApp.2008", "src\Spring.WcfQuickStart.ServerApp\Spring.WcfQuickStart.ServerApp.2008.csproj", "{27AAD98C-4281-4DD4-9E20-1371C58C5283}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Aop.2005", "..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj", "{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.Debug = "False"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Release|.NET = Release|.NET
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D58B3101-4433-49C5-B41B-51134424FC42}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Release|.NET.ActiveCfg = Release|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Release|Any CPU.Build.0 = Release|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D58B3101-4433-49C5-B41B-51134424FC42}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|.NET.ActiveCfg = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|.NET.Build.0 = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|Any CPU.ActiveCfg = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|Mixed Platforms.ActiveCfg = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Debug|Mixed Platforms.Build.0 = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|.NET.ActiveCfg = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|.NET.Build.0 = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|Any CPU.ActiveCfg = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|Mixed Platforms.ActiveCfg = Debug|.NET
{B71CEEE1-9C92-4C79-94BE-46D6D4CDE95A}.Release|Mixed Platforms.Build.0 = Debug|.NET
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|.NET.ActiveCfg = Debug|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|.NET.ActiveCfg = Release|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.Build.0 = Release|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|.NET.ActiveCfg = Debug|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|.NET.ActiveCfg = Release|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Any CPU.Build.0 = Release|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|.NET.ActiveCfg = Debug|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|.NET.ActiveCfg = Release|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Any CPU.Build.0 = Release|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{27AAD98C-4281-4DD4-9E20-1371C58C5283}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|.NET.ActiveCfg = Debug|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|.NET.ActiveCfg = Release|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.Build.0 = Release|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<spring>
<context>
<!-- Make sure 'http://localhost:2637/Spring.WcfQuickStart.Web/' web application is running -->
<resource uri="assembly://Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.Config/Web.xml" />
<!-- Make sure 'ServerApp' console application is running and listening. -->
<resource uri="assembly://Spring.WcfQuickStart.ClientApp/Spring.WcfQuickStart.Config/ServerApp.xml" />
</context>
</spring>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="webCalculatorEndpoint"
address="http://localhost:2637/Spring.WcfQuickStart.Web.2008/Calculator.svc"
binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1"
contract="Spring.WcfQuickStart.ICalculator" />
<endpoint name="serverAppCalculatorEndpoint"
address="http://localhost:8000/Spring.WcfQuickStart/service"
binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1"
contract="Spring.WcfQuickStart.ICalculator" />
</client>
</system.serviceModel>
</configuration>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<!-- returns ChannelFactory<ICalculator>("calculatorEndpoint").CreateChannel() -->
<object id="serverAppCalculator"
type="Spring.WcfQuickStart.ICalculator, Spring.WcfQuickStart.ClientApp"
factory-object="serverAppCalculatorChannelFactory"
factory-method="CreateChannel" />
<object id="serverAppCalculatorChannelFactory"
type="System.ServiceModel.ChannelFactory&lt;Spring.WcfQuickStart.ICalculator>, System.ServiceModel">
<constructor-arg name="endpointConfigurationName" value="serverAppCalculatorEndpoint" />
</object>
</objects>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<!-- returns ChannelFactory<ICalculator>("calculatorEndpoint").CreateChannel() -->
<object id="webCalculator"
type="Spring.WcfQuickStart.ICalculator, Spring.WcfQuickStart.ClientApp"
factory-object="webCalculatorChannelFactory"
factory-method="CreateChannel" />
<object id="webCalculatorChannelFactory"
type="System.ServiceModel.ChannelFactory&lt;Spring.WcfQuickStart.ICalculator>, System.ServiceModel">
<constructor-arg name="endpointConfigurationName" value="webCalculatorEndpoint" />
</object>
</objects>

View File

@@ -0,0 +1,20 @@
using System;
using System.ServiceModel;
namespace Spring.WcfQuickStart
{
[ServiceContract(Namespace = "http://Spring.WcfQuickStart")]
public interface ICalculator
{
[OperationContract]
double Add(double n1, double n2);
[OperationContract]
double Subtract(double n1, double n2);
[OperationContract]
double Multiply(double n1, double n2);
[OperationContract]
double Divide(double n1, double n2);
[OperationContract]
string GetName();
}
}

View File

@@ -0,0 +1,78 @@
#region License
/*
* Copyright <20> 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
using Spring.Context;
using Spring.Context.Support;
using Spring.WcfQuickStart;
#endregion
namespace Spring.WcfQuickStart.ClientApp
{
class Program
{
[STAThread]
static void Main()
{
try
{
Pause();
IApplicationContext ctx = ContextRegistry.GetContext();
foreach (ICalculator calculator in ctx.GetObjectsOfType(typeof(ICalculator)).Values)
{
try
{
Console.WriteLine(calculator.GetName());
Console.WriteLine("Add(1, 1) : " + calculator.Add(1, 1));
Console.WriteLine("Divide(11, 2) : " + calculator.Divide(11, 2));
Console.WriteLine("Multiply(2, 5) : " + calculator.Multiply(2, 5));
Console.WriteLine("Subtract(7, 4) : " + calculator.Subtract(7, 4));
Console.WriteLine();
}
catch (Exception e)
{
Console.WriteLine(e);
Console.WriteLine();
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
finally
{
Pause();
}
}
public static void Pause()
{
Console.Write("--- Press <return> to continue ---");
Console.ReadLine();
}
}
}

View File

@@ -0,0 +1,33 @@
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("Spring.WcfQuickStart.ClientApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Spring.WcfQuickStart.ClientApp")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[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("7e54828a-b567-496d-98fa-c1e83019b699")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,66 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D58B3101-4433-49C5-B41B-51134424FC42}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.ClientApp</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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|AnyCPU' ">
<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.Data" />
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ICalculator.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2005</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\src\Spring\Spring.Services\Spring.Services.2008.csproj">
<Project>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Project>
<Name>Spring.Services.2008</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<EmbeddedResource Include="Config\Web.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Config\ServerApp.xml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<parsers>
<parser namespace="http://www.springframework.net/aop"
type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop"
schemaLocation="assembly://Spring.Aop/Spring.Aop.Config/spring-aop-1.1.xsd" />
</parsers>
<objects xmlns="http://www.springframework.net"
xmlns:aop="http://www.springframework.net/aop">
<!-- Service definition -->
<object id="calculator"
type="Spring.WcfQuickStart.CalculatorService, Spring.WcfQuickStart.ServerApp">
<property name="SleepInSeconds" value="1"/>
</object>
<object type="Spring.ServiceModel.ServiceExporter, Spring.Services">
<property name="TargetName" value="calculator" />
</object>
<object id="serviceOperation" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop">
<property name="pattern" value="Spring.WcfQuickStart.*"/>
</object>
<object id="perfAdvice" type="Spring.WcfQuickStart.SimplePerformanceInterceptor, Spring.WcfQuickStart.ServerApp">
<property name="Prefix" value="Service Layer Performance"/>
</object>
<aop:config>
<aop:advisor pointcut-ref="serviceOperation" advice-ref="perfAdvice"/>
</aop:config>
</objects>
</spring>
<common>
<logging>
<!--
You may use http://www.microsoft.com/technet/sysinternals/Miscellaneous/DebugView.mspx
for viewing TraceLogger output
-->
<factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
<arg key="Level" value="ALL" />
<!-- Possible values are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
</factoryAdapter>
</logging>
</common>
<system.serviceModel>
<services>
<service name="calculator" behaviorConfiguration="DefaultBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/Spring.WcfQuickStart/service"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
contract="Spring.WcfQuickStart.ICalculator" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

View File

@@ -0,0 +1,51 @@
using System;
using System.Threading;
namespace Spring.WcfQuickStart
{
public class CalculatorService : ICalculator
{
private int sleepInSeconds;
public int SleepInSeconds
{
get { return sleepInSeconds; }
set { sleepInSeconds = value; }
}
public double Add(double n1, double n2)
{
Thread.Sleep(sleepInSeconds*1000);
return n1 + n2;
}
public double Subtract(double n1, double n2)
{
Thread.Sleep(sleepInSeconds * 1000);
return n1 - n2;
}
public double Multiply(double n1, double n2)
{
Thread.Sleep(sleepInSeconds * 1000);
return n1 * n2;
}
public double Divide(double n1, double n2)
{
Thread.Sleep(sleepInSeconds * 1000);
return n1 / n2;
}
public string GetName()
{
Thread.Sleep(sleepInSeconds * 1000);
return "ServerApp Calculator";
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.ServiceModel;
namespace Spring.WcfQuickStart
{
[ServiceContract(Namespace = "http://Spring.WcfQuickStart")]
public interface ICalculator
{
[OperationContract]
double Add(double n1, double n2);
[OperationContract]
double Subtract(double n1, double n2);
[OperationContract]
double Multiply(double n1, double n2);
[OperationContract]
double Divide(double n1, double n2);
[OperationContract]
string GetName();
}
}

View File

@@ -0,0 +1,63 @@
#region License
/*
* Copyright <20> 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
using Spring.Context.Support;
using Spring.ServiceModel;
#endregion
namespace Spring.WcfQuickStart
{
class Program
{
[STAThread]
static void Main()
{
try
{
// Using Spring's IoC container
ContextRegistry.GetContext(); // Force Spring to load configuration
Console.Out.WriteLine("Server listening...");
Console.Out.WriteLine("--- Press <return> to quit ---");
Console.ReadLine();
// Programmatically (You need to comment 'ServiceExporter' object definition in App.config)
//using (ServiceHost serviceHost = new ServiceHost("calculator"))
//{
// serviceHost.Open();
// Console.Out.WriteLine("Server listening...");
// Console.Out.WriteLine("--- Press <return> to quit ---");
// Console.ReadLine();
//}
}
catch (Exception e)
{
Console.Out.WriteLine(e);
Console.Out.WriteLine("--- Press <return> to quit ---");
Console.ReadLine();
}
}
}
}

View File

@@ -0,0 +1,33 @@
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("Spring.WcfQuickStart.ServerApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Spring.WcfQuickStart.ServerApp")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[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("21c7f6d2-71a8-4d74-ae60-1d14cf79c975")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,45 @@
using System;
using System.Reflection;
using AopAlliance.Intercept;
using Common.Logging;
namespace Spring.WcfQuickStart
{
public class SimplePerformanceInterceptor : IMethodInterceptor
{
#region Logging Definition
private readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#endregion
private string prefix = "Invocation took";
public string Prefix
{
get { return prefix; }
set { prefix = value; }
}
#region IMethodInterceptor Members
public object Invoke(IMethodInvocation invocation)
{
DateTime start = DateTime.Now;
try
{
return invocation.Proceed();
}
finally
{
DateTime stop = DateTime.Now;
TimeSpan time = stop - start;
log.Info(Prefix + " " + time);
}
}
#endregion
}
}

View File

@@ -0,0 +1,72 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{27AAD98C-4281-4DD4-9E20-1371C58C5283}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.WcfQuickStart</RootNamespace>
<AssemblyName>Spring.WcfQuickStart.ServerApp</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=1.0.2.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CalculatorService.cs" />
<Compile Include="ICalculator.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SimplePerformanceInterceptor.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj">
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
<Name>Spring.Aop.2005</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2005</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\src\Spring\Spring.Services\Spring.Services.2008.csproj">
<Project>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Project>
<Name>Spring.Services.2008</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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>

View File

@@ -0,0 +1,29 @@
using System;
public class CalculatorService : ICalculator
{
public double Add(double n1, double n2)
{
return n1 + n2;
}
public double Subtract(double n1, double n2)
{
return n1 - n2;
}
public double Multiply(double n1, double n2)
{
return n1 * n2;
}
public double Divide(double n1, double n2)
{
return n1 / n2;
}
public string GetName()
{
return "Web Calculator";
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.ServiceModel;
[ServiceContract(Namespace = "http://Spring.WcfQuickStart")]
public interface ICalculator
{
[OperationContract]
double Add(double n1, double n2);
[OperationContract]
double Subtract(double n1, double n2);
[OperationContract]
double Multiply(double n1, double n2);
[OperationContract]
double Divide(double n1, double n2);
[OperationContract]
string GetName();
}

View File

@@ -0,0 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="calculator" Factory="Spring.ServiceModel.Activation.ServiceHostFactory" %>

View File

@@ -0,0 +1,106 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<!-- Service definition -->
<object id="calculator" type="CalculatorService, App_Code" />
</objects>
</spring>
<system.serviceModel>
<services>
<service name="calculator" behaviorConfiguration="DefaultBehavior">
<endpoint address=""
binding="basicHttpBinding"
contract="ICalculator" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.Transactions.Bridge, Version=3.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="SMDiagnostics, Version=3.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.IdentityModel.Selectors, Version=3.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>