Cannot register the URL prefix ‘https…” when physical folder was deleted

Afrer iisreset  on production server I’ve got the error
 
“Cannot register the URL prefix ‘https://*:443/OldFolder/’ for site ‘1’. The site has been deactivated. “
The problem was that IIS folder still existed, when physical folder was deleted.
Only after I deleted the virtual folder, I was able to start web site. 
 
Different reasons to see the same errors are described in
http://support.microsoft.com/kb/890015 ” You receive a “The process cannot access the file because it is being used by another process” error message when you try to start a Web site in the Internet Information Services MMC snap-in”
 
http://forums.iis.net/t/1116890.aspx “are you using Skype? Well, than check whether in Skypes’ Advanced- Connection- Settings the ‘Use port 80 and 443 as alternatives for incoming connections’ checkbox is not checked.”

An extension method to Find Sibling Activity

I’ve created an extension method  to Find Sibling Activity by name
Based on example from http://msdn.microsoft.com/en-us/magazine/cc163414.aspx
public static TActivity FindSiblingActivity<TActivity>(this Activity sender,string activityName) where TActivity:Activity
{
//CodeActivity thisActivityInstance = sender as   CodeActivity;sender.
Activity parent =   sender.Parent;
   var retActivity=parent.GetActivityByName(activityName) as TActivity;
   Debug.Assert(sender.IsDynamicActivity==retActivity.IsDynamicActivity,” EXPECTED BOTH BE DYNAMIC”);
   return retActivity;
}
Related links http://geekswithblogs.net/mnf/archive/2009/04/21/workflow-activities-should-be-referred-by-sender-object-or.aspx
http://codeidol.com/other/essential-windows-workflow-foundation/Advanced-Activity-Execution/Activity-Execution-Context/

Use WCF Binary Encoding when Host in IIS6

I wanted to replace .Net Remoting calls with WCF.

Article From .NET Remoting to the Windows Communication Foundation (WCF)was very useful for me. It was misleading reference to Attribute ReturnUnknownExceptionsAsFaults which doesn’t exist any more.It has been changed to IncludeExceptionDetailInFaults,

I wanted to use WCF Binary Encoding when Host in Windows 2003 Server(IIS6) instead of text encoding, that is coming out-of-the-box
I found the blog WCF: Enable Binary Encoding Over Http
and literally copied custom binding settings from the blog
<binding name=”NetHttpBinding”>

         <reliableSession />

         <compositeDuplex />

         <oneWay />

         <binaryMessageEncoding />

         <httpTransport />

       </binding>

I was able to call the service successfully, but then client  was timed-out on response. It took me some time to debug until I recognized that the settings include    <oneWay />

Obviously it should be removed, if i am using a synchronous call.

So the minimum custom binding settings is
<binding name=”BinaryHttpBinding”>

          <binaryMessageEncoding />

         <httpTransport />

</binding>

If you have big objects to transfer, you need to increase size limits similar to the following
       <binding name=”BinaryHttpBinding”><!–For Remoting–>
                   <binaryMessageEncoding >
                       <readerQuotas   maxStringContentLength=”43647″ />                    </binaryMessageEncoding>
                   <httpTransport maxReceivedMessageSize=”83647″ />                 </binding>

Discussion that helped http://stackoverflow.com/questions/3367197/wcf-custombinding-duplex-fails-to-open-client-port

My EnglishGrammerHelper class

The class below is used to create adjustable messages

using System;

    /// Summary description for EnglishGrammerHelper.
    /// </summary>
    public class EnglishGrammerHelper
    {
        public EnglishGrammerHelper()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        /// <summary>
        /// Compiles sentence with person,verb and rest of the sentence
        /// </summary>
        /// <param name=”person”></param>
        /// <param name=”verb”></param>
        /// <param name=”restSentence”></param>
        /// <returns></returns>
        public static string PersonMessage(string person, string verb, string restSentence)
        {
             switch(person.ToLower())
             {
                 case “you”:
                    verb=Verb(verb,true);
                    break;
                 default://not you -he/she
                    verb=Verb(verb,false);
                    break;
             }//switch person
            return string.Format(“{0} {1} {2}”,person,verb, restSentence);
        }
        //may be better to make private?
        public static string Verb( string verb, bool bPlural)
        {
          if((bPlural))
          {
               switch(verb.ToLower())
               {
                   case “has”:
                       verb=”have”;
                       break;
                   case “does”:
                       verb=”do”;
                       break;
                   case “was”:
                       verb=”were”;
                       break;
                   default://leave as it is
                       break;
               }
          }
          else
          {
               switch(verb.ToLower())
               {
                   case “have”:
                       verb=”has”;
                       break;
                   case “do”:
                       verb=”does”;
                       break;
                   case “were”:
                       verb=”was”;
                       break;
                   default://leave as it is
                       break;
               }
           }
            return verb;
        }
       public static string Plural(string item)
       {
           string sItemItems = item;
           if (!sItemItems.EndsWith(“s”))
               sItemItems += ‘s’; //make it plural
            return sItemItems;
      }
       public static string NumberItems(int count, string item, string verb, string restSentence)
        {
            string sItemItems=item;
            if (count!=1)
            {
                if (!sItemItems.EndsWith(“s”))
                    sItemItems+=’s’; //make it plural
            }
            verb=Verb(verb,(count!=1));
            return string.Format(“{0} {1} {2} {3}”,count.ToString() , sItemItems,verb, restSentence);
        }
       /// <summary>
       ///
       /// </summary>
       /// <param name=”EstimateWord”>e.g “At least”</param>
       /// <param name=”count”></param>
       /// <param name=”item”></param>
       /// <param name=”verb”></param>
       /// <param name=”restSentence”></param>
       /// <returns></returns>
       public static string NumberItems(string EstimateWord, int count, string item, string verb, string restSentence)
       {
           if(String.IsNullOrEmpty(EstimateWord))
           {
              EstimateWord= StringHelper.EnsureEndsWith(EstimateWord, ” “);
           }
           return string.Concat(EstimateWord + NumberItems( count,  item,  verb,  restSentence)) ;
       }

IsSubsetOf List extension

I’ve created  IsSubsetOf List extension based on discussion at http://stackoverflow.com/questions/332973/linq-check-whether-an-array-is-a-subset-of-another

/// <summary>
  /// Determines whether a System.Collections.Generic.List<T> object is a subset of the specified collection.
  /// http://stackoverflow.com/questions/332973/linq-check-whether-an-array-is-a-subset-of-another
  /// </summary>
  /// <param name=”list”></param>
  /// <param name=”listToFind”></param>
  /// <returns></returns>
  public static bool IsSubsetOf<T>(this List<T> coll1, List<T> coll2)
  {
   bool isSubset = !coll1.Except(coll2).Any();
   return isSubset;
  }

FromToRange template class

In many scenarios I found useful to store data in FromToRange template class.

It is more descriptive than generic Tuple Class

/// <summary>

/// Summary description for FromToRange.

/// </summary>

public class FromToRange<T>

{

public T From;

public T To;

/// <summary>

/// </summary>

/// <param name=”from”></param>

/// <param name=”to”></param>

public FromToRange(T from, T to)

{

From = from;

To = to;

}

#region Static Public methods

#endregion //Static Public methods

}//end struct FromToRange

Search systems on desktop/enterprise level

I’ve put together a few links regarding search systems on desktop/enterprise level


http://desktop.google.com/features.html