TechEd 2005: Orlando 

Categories:  Other
Thursday, March 31, 2005 11:14:11 AM (Central Europe Standard Time, UTC+01:00)  #    Comments

 

 Old blog RSS is now discontinued 

This weblog is now only available on the following RSS URL:

http://www.request-response.com/blog/SyndicationService.asmx/GetRss

It's been a year since the address was changed, and now the time has come to retire the old RSS feed redirect.

Update: Upgrade to dasBlog 1.7.5016.2 was really smooth (read simple), due to excellent docs from Omar and this wiki.

Categories:  Blogging
Sunday, March 27, 2005 9:32:03 PM (Central Europe Standard Time, UTC+01:00)  #    Comments

 

 Indigo - Instancing 

The following service will allow you to check how Indigo instancing behaviour works:

using System;
using System.ServiceModel;

[ServiceContract]
interface ICanRandom
{
 [OperationContract]
 int Randomize(int intLow, int intHigh);

 [OperationContract]
 int GetLastNumber();
}

[ServiceBehavior(InstanceMode = InstanceMode.Singleton, ConcurrencyMode = ConcurrencyMode.Multiple)]
public class RandomizerService : ICanRandom
{
 private int intLastNumber;
 private Random r = new Random(DateTime.Now.Millisecond);

 public int Randomize(int intLow, int intHigh)
 {
  System.Threading.Thread.Sleep(5000);
  int intRandomNumber = r.Next(intLow, intHigh);
  intLastNumber = intRandomNumber;
  return intRandomNumber;
 }

 public int GetLastNumber()
 {
  return intLastNumber;
 }
}

This service will return a random number for multiple clients. Try simulating it with the following client code:

using System;
using System.Threading;

class Program
{
 static void Main(string[] args)
 {
  Thread t1 = new Thread(new ParameterizedThreadStart(Program.CallService));
  Thread t2 = new Thread(new ParameterizedThreadStart(Program.CallService));
  Console.WriteLine("Threads running.");
  t1.Start(1);
  t2.Start(2);
 }

 static void CallService(object intThread)
 {
  CanRandomProxy objWS = new CanRandomProxy("ICanRandom");
  Console.WriteLine("Thread {0} - Method call.", intThread);
  Console.WriteLine("Thread {0} - Random number: {1}", intThread, objWS.Randomize(10, 110));
  Console.WriteLine("Thread {0} - Last random number: {1}", intThread, objWS.GetLastNumber());
  Console.WriteLine("Thread {0} - Done.", intThread);
 }
}

Singleton services process all requests using a single service instance. Try changing the ConcurrencyMode property of ServiceBehaviour attribute to obtain different instancing semantics. Having InstanceMode set to PerCall (current default) will disable ConcurrencyMode.Multiple behaviour, which is expected.

Categories:  .NET 3.0 - WCF
Sunday, March 27, 2005 9:04:33 PM (Central Europe Standard Time, UTC+01:00)  #    Comments

 

 Indigo CTP 

Microsoft “Indigo” is now available for general public.

If you are an MSDN Subscriber, you can download the bits from here.

Categories:  Web Services | Work | XML
Sunday, March 20, 2005 6:34:26 PM (Central Europe Standard Time, UTC+01:00)  #    Comments

 

Copyright © 2003-2014 , Matevž Gačnik
Recent Posts
RD / MVP
Feeds
RSS: Atom:
Archives
Categories
Blogroll
Legal

The opinions expressed herein are my own personal opinions and do not represent my company's view in any way.

My views often change.

This blog is just a collection of bytes.

Copyright © 2003-2014
Matevž Gačnik

Send mail to the author(s) E-mail