Permalink
Browse files

Add a WCF web service 'Call.svc' with one endpoint, IFileTracker

  • Loading branch information...
1 parent afa4e01 commit 12d920815aa0d842942288847ec21033c4fbd3f1 @milang milang committed Aug 18, 2011
@@ -0,0 +1 @@
+<%@ ServiceHost Language="C#" Debug="true" Service="SampleWcf.Web.Call" CodeBehind="Call.svc.cs" %>
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.ServiceModel.Activation;
+
+namespace SampleWcf.Web
+{
+
+ /// <summary>
+ /// </summary>
+ [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
+ public class Call : IFileTracker
+ {
+
+ //**************************************************
+ //* Interface IFileTracker implementation
+ //**************************************************
+
+ //--------------------------------------------------
+ /// <summary>
+ /// </summary>
+ public void Track(IEnumerable<string> files)
+ {
+ Debugger.Log(0, null, string.Concat("--- Received files:", Environment.NewLine));
+ if (files != null)
+ {
+ foreach (var file in files)
+ {
+ Debugger.Log(0, null, string.Concat("File: \"", file, "\"", Environment.NewLine));
+ }
+ }
+ Debugger.Log(0, null, string.Concat("--- Received files end", Environment.NewLine));
+ }
+
+ }
+
+}
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using System.ServiceModel;
+
+namespace SampleWcf.Web
+{
+
+ [ServiceContract]
+ public interface IFileTracker
+ {
+
+ [OperationContract]
+ void Track(IEnumerable<string> files);
+
+ }
+
+}
@@ -38,6 +38,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.ServiceModel" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
@@ -51,14 +53,19 @@
<Reference Include="System.Web.ApplicationServices" />
</ItemGroup>
<ItemGroup>
+ <Content Include="Call.svc" />
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Call.svc.cs">
+ <DependentUpon>Call.svc</DependentUpon>
+ </Compile>
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
+ <Compile Include="FileTracker.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup />
@@ -39,6 +39,29 @@
</system.web>
<system.webServer>
+ <validation validateIntegratedModeConfiguration="true"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
+ <system.serviceModel>
+ <behaviors>
+ <serviceBehaviors>
+ <behavior name="SampleWcfServiceBehaviour">
+ <serviceMetadata httpGetEnabled="true" />
+ <serviceDebug includeExceptionDetailInFaults="false" />
+ </behavior>
+ </serviceBehaviors>
+ <endpointBehaviors>
+ <behavior name="SampleWcfEndpointWebBehavior">
+ <webHttp defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="True" defaultBodyStyle="WrappedRequest" helpEnabled="False" />
+ </behavior>
+ </endpointBehaviors>
+ </behaviors>
+ <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
+ <services>
+ <service name="SampleWcf.Web.Call" behaviorConfiguration="SampleWcfServiceBehaviour">
+ <endpoint address="FileTracker" behaviorConfiguration="SampleWcfEndpointWebBehavior" binding="webHttpBinding" contract="SampleWcf.Web.IFileTracker" />
+ <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
+ </service>
+ </services>
+ </system.serviceModel>
</configuration>

0 comments on commit 12d9208

Please sign in to comment.