diff --git a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.cs b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.cs
index 5a25d5e..d1d98f3 100644
--- a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.cs
+++ b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Fabric;
using System.Linq;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.ServiceFabric.Services.Communication.Runtime;
@@ -36,15 +37,12 @@ protected override async Task RunAsync(CancellationToken cancellationToken)
// TODO: Replace the following sample code with your own logic
// or remove this RunAsync override if it's not needed in your service.
- long iterations = 0;
-
- while (true)
+ while (!cancellationToken.IsCancellationRequested)
{
- cancellationToken.ThrowIfCancellationRequested();
-
- ServiceEventSource.Current.ServiceMessage(this, "Working-{0}", ++iterations);
-
- await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
+ var dataPackage = this.Context.CodePackageActivationContext.GetDataPackageObject("TestData");
+ var text = File.ReadAllText(Path.Combine(dataPackage.Path, "data.txt"));
+ ServiceEventSource.Current.ServiceMessage(this, text);
+ await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
}
}
}
diff --git a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.csproj b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.csproj
index 739a622..2538d41 100644
--- a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.csproj
+++ b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirect/ConsoleRedirect.csproj
@@ -12,6 +12,21 @@
v4.5.2
512
true
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
true
@@ -81,6 +96,22 @@
+
+
+
+ False
+ Microsoft .NET Framework 4.5.2 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
+
-
+
-
+
scripts\test.cmd
@@ -27,8 +27,11 @@
-
+
+
+
+
-
+
diff --git a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Cloud.xml b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Cloud.xml
index 1301dd8..67d9b96 100644
--- a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Cloud.xml
+++ b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Cloud.xml
@@ -22,4 +22,7 @@
-->
+
+
+
\ No newline at end of file
diff --git a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Local.xml b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Local.xml
index 55fc650..90f905b 100644
--- a/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Local.xml
+++ b/Chapter05/ConsoleRedirectTestApplication/ConsoleRedirectTestApplication/PublishProfiles/Local.xml
@@ -8,7 +8,7 @@
-->
-
+
\ No newline at end of file