Friday, July 8, 2016

"Keyset does not exist" error message when you try to change the identity of an application pool by using Internet Information Services


When I try to change the identity of any application pool, received the following error message:

---------------------------
Application Pools
---------------------------
There was an error while performing this operation.

Details:

Keyset does not exist (Exception from HRESULT: 0x80090016)


Reason : 
         There is not enough permissions to open file

  • %ALLUSERSPROFILE%\Microsoft\Crypto\RSA\MachineKeys\ 6de9cb26d2b98c01ec4e9e8b34824aa2_*
  • %ALLUSERSPROFILE%\Microsoft\Crypto\RSA\MachineKeys\ 76944fb33636aeddb9590521c2e8815a_*


Resolution

  1.     Go to '%ALLUSERSPROFILE%\Microsoft\Crypto\RSA\MachineKeys'
  2.     Find files with name starts as 6de9cb26d2b98c01ec4e9e8b34824aa2_ and                            76944fb33636aeddb9590521c2e8815a_.
  3.    Check permission for this file. Default permissions are:
    •        System, Administrators,TrustedInstaller - Full permissions
    •       IIS_IUSR,WMSVC - Read permissions
    •       LOCAL SERVICE - Read permission

If the issue still persists:

Take backup of MachineKeys (%ALLUSERSPROFILE%\Microsoft\Crypto\RSA\MachineKeys)
Give full permissions to your account to access the MachineKeys folder.

  Please check that files have name 6de9cb26d2b98c01ec4e9e8b34824aa2_GUID and 76944fb33636aeddb9590521c2e8815a_GUID .

If not, just copy existing files started with name 6de9cb26d2b98c01ec4e9e8b34824aa2_ and 76944fb33636aeddb9590521c2e8815a_ and then set GUID part in the file name equals to GUID obtained from MachineGuid registry key from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryprography\





Wednesday, June 1, 2016

C# 6.0 New Features

Using Static Statement
We all know that you can import a namespace with using.  This gives us the ability to use a type with just the type’s name in our code. 
using System;

public class Driver
{
    public static void Main()
    {
         // without importing a namespace, we'd have to fully qualify the type
        // Console as System.Console
       //System.Console.WriteLine("Hello, World!");

        Console.WriteLine("Hello, World!");
    }
}

In C#6.0, import the static members of a class into our namespace , making them available without qualification in subsequent code:
using static System.Console;
 
public class Driver
{
    public static void Main()
    {
        // Now, the System.Console static class is imported, so we
        // can use WriteLine directly
        WriteLine("Hello, World!");
    }
}
 
void Main()
{
    MyStaticClass.Print("this string");      //Print is a static member in MyStaticClass
    // or...
    Print("this string");
}
 
Importing static types and accessing extension methods of them like the code above will give you an error. The following code will generate the "The name 'IsPolygon' does not exist in the current context".
Non-extension static methods are invoked as though they are methods on the current type, whereas extension methods are invoked only as though they are methods on a variable.
Read only Property and initialization
Public string Name {get;} = “XXXXX”;       or            public string Name => “XXXX”;
Expression-Bodied Get-Only Properties
Now, if you have a property that is get-only, you can write the body of the property using the expression syntax.  That is, you can use the lambda-expression syntax to write the body of the property. 
That is, instead of writing the { get { return your expression; } } syntax, we can simply write => your expression;
For example, if we convert our get-only properties above, we can get:
   1: public class Rectangle
   2: {
   3:     public int Length { get; set; }
   4:     public int Width { get; set; }
   5:  
   6:     // much more concise! Read Only properties
   7:     public int Area => Length * Width;
   8:     public int Perimeter => 2 * (Length + Width);
   9:  
  10:     public override string ToString()
  11:     {
  12:         return $"Rectange: Length={Length}, Width={Width}";
  13:     }
  14: }
It does not create a delegate, it is simply borrowing the lambda expression syntax to simplify writing simple bodies that result in an expression.
After lambda express we always have single statement.
Expression-bodied function members can work for both methods and properties. If you have a method with one statement, and that statement can be represented as an expression:
public string GetFullName() {
  return FirstName + " " + LastName;
}
Or a getter-only properties/indexers with a body that can be represented as an expression:
public string FormalName {
  get { return FirstName[0] + ". " + LastName; }
}
Public object TestObj {get {return obj;}}                //Read only property
You can collapse those down into something that looks like a cross between a member declaration and a lambda expression:
public string GetFullName() => FirstName + " " + LastName;
public string FormalName => FirstName[0] + ". " + LastName;
public object TestObj => obj;      //Read only property in C#6.0
Null Propagation Operator
In earlier versions of the C# language, we always had to write an if condition for a null check before using an object or its property. Now C# 6.0 has introduced the Null-Propagation Operator (?.) that enables developers to check for the null value within an object reference chain. The null-propagation operator (?.) will return null if anything in the object reference chain is null.

Example 1
In earlier versions of the C# language, you always had to check for nulls explicitly before using an object or its property, as shown below:
Hide   Copy Code
if (Employee.Name == null
    Console.WriteLine("No Employee name provided"); 
}
The same can be converted into a one-liner using the Conditional Access Operator in C# 6.
Hide   Copy Code
Console.WriteLine(Employee?.Name ?? "No Employee name provided");
Example 2
Suppose we have a class called Student that has another property studentdetails of type Details class. Now we can have the following code snippet to print theAddress .
Hide   Copy Code
if (student != null && student.studentdetails != null
    Console.WriteLine(student.studentdetails.Address); 
else 
    Console.WriteLine("No Address"); 
}
As we can see, to avoid the null-reference exception, we have checked the null for student andstudent.studentdetails since they can have a null reference as object. So, the preceding code snippet can be re-written using the null propagation operator (?.) as follows:
Hide   Copy Code
Console.WriteLine(student?.studentdetails?.Address ?? "No Address");
Both code snippets will provide us the address of the student.

What I think is, it's a really nice feature because instead of checking each and individual objects, using the nullpropagation operator (?.) we can check the entire chain of references together and whenever there is a nullvalue in the entire chain of reference, it will return null.

nameof Operator
nameof operator allows you to retrieve the name of a variable, type or member.
Use the nameof operator to avoid the use of hard-coded strings in our code.
This operator will help us get rid of “magic strings” in our code. We all know following use case:
public void Method(int arg)
{
    if (arg < 0)
    {
        throw new ArgumentOutOfRangeException("arg");
    }
}
With nameof operator we can rewrite code in a nicer way:
public void Method(int arg)
{
    if (arg < 0)
    {
        throw new ArgumentOutOfRangeException(nameof(arg));
    }
}
That is! nameof just returns a string representation of variable\method\type\propery\field.

String Interpolation
This feature inserts values into a string with simple syntax. It is similar to string.Format, but variables may be accessed directly
            string name = "Valentino";
            int age = 7;

            var data1 = string.Format("name:{0}, age:{1}", name, age);
            Console.WriteLine("classic string format - {0}", data1);

            var data2 = $"name:{name}, age:{age}";
            Console.WriteLine("string interpolation  - {0}", data2);
            Console.ReadLine();

Exception Filters
It allows us to specify conditions along with a catch block. The catch block is only executed if the condition satisfies. 
public void Main()
{
  try
  {  
      throw new Exception("E2");
  }
  catch(Exception ex) when(ex.Message == "E1")
  {
    Console.WriteLine("caught E1");
  }
  catch(Exception ex) when(ex.Message == "E2")
  {
    Console.WriteLine("caught E2");
  }
}

Setting default values to Auto Properties
Now we can assign default value to the properties without writing a second line.  Just place an “=” equal sign at the end and write the default value to it.
Earlier we used to have to do this by setting the default value in the constructor
public string FirstName { get; set; } = "Default Value";

Wednesday, February 24, 2016

Get value when selected an item from datalist

The datalist element and the list attribute are the two new HTML features that bind up the autocomplete functionality.

I have used above features to implement autocomplete functionality in my sample.

My requirement is to select a cityName from the datalist and want to get cityId from cityList

 <input list="fromCityList" required type="text" name="fromCity" placeholder="City" ng-model="Trip.from.city" ng-change="Trip.from.id = (cityList|filter:{name:Trip.from.city})[0].id">
                                                <datalist id="fromCityList" >
                                                    <select>
                                                        <option ng-repeat="city in cityList | filter : {name : Trip.from.city}"
                                                                value="{{city.name}}" ></option>
                                                    </select>
                                                </datalist> 


I have ued the built-in filter to retrieve the correct cityId value for the cityName.


Monday, January 11, 2016

Why BizTalk not supporting multiple send locations for one send port?

     We can have multiple disassemblers in Receive Pipeline, we can receive multiple format files from the same receive pipeline. It execute all the components (0 to 255)placed in it.

     But we cannot have multiple assemblers in Send Pipeline (it can have only 0 to 1). So, we can't use  to send multiple format files through the same Send pipeline.


What if we  want to send multiple format files through the same Send pipeline ?
    We can create a Send port for each format and add them to a Send Port Group

Even I too have this below question in my mind, any idea!

Why BizTalk doesn't provide this feature, BizTalk server is not supporting more than one send location for one send port?

Wednesday, January 6, 2016

Identity (===. !==) vs Equality (==, !=) operators in JavaScript



These operators behave identically to the equality operators except no type conversion is done, and the types must be the same to be considered equal.

Using the == operator (Equality)

     true == 1; //true, because 'true' is converted to 1 and then compared
     "2" == 2;  //true, because "2" is converted to 2 and then compared

Using the === operator (Identity)

     true === 1; //false
     "2" === 2;  //false

This is because the equality operator == does type coercion, meaning that the interpreter implicitly tries to convert the values before comparing.

On the other hand, the identity operator === does not do type coercion, and thus does not convert the values when comparing.

Saturday, November 14, 2015

An error occurred while parsing EntityName in asp.net

In my AppSettings in web.config, I have something like this:

<appSettings>
    <add key="ExternalUrl" value="http://domain.com/samplepage.aspx?id={0}&action=xx" />
</appSettings>

However, it seems that when an ampersand (&) is included in an AppSettings value, ASP.NET throws the following error:

An error occurred while parsing EntityName.

Solution:
Replace & with &amp;

<add
    key="ExternalUrl"
    value="http://domain.com/samplepage.aspx?id={0}&amp;action=xx" />

Wednesday, August 5, 2015

What is new in BizTalk 2013


     BizTalk 2013 includes many new features that make developing and deploying for BizTalk much more efficient.  There are also many new features which expand on the already huge capabilities of a BizTalk Solution.

New Adapters
     It has set of new adapters which allow for connectivity to other applications and protocols, such as Windows Azure and RESTful services.


  • SB-Messaging Adapter: The SB-Messaging adapter allows BizTalk to send and receive messages form the Queues, Topics and Relays of a Service Bus such as Windows Azure.
  • WCF-BasicHttpRelay Adapter: Allows BizTalk to communicate with an ASMX Web services using the WCF protocol.
  • NetTcpRelay Adapater: Send and receive WCF calls using the secure NetTcpRelayBinding.
  • WCF-WebHttp Adapter: The WCF-WebHttp adapter allows BizTalk to send and receive, or expose BizTalk artifacts using REST.
  • SharePoint Services Adapter: Sends and Receives messages to SharePoint Services
  • SFTP Adapter: Enables Biztalk to securely send and receive messages to FTP servers using SSH.
     WCF-WebHttp, SFTP, SB-Messaging, WCF-BasicHttpRelay and the WCF-NetTcpRelay adapters allow for easy communication with Azure.


Configurable Dynamic Send Port
     In BizTalk Server 2010 and previous versions, dynamic send ports used the default host instance, without the ability to change the host instance handler used by the dynamic send port. 


Scenario
     There are two ESB itineraries in an application. Itinerary1 uses a Dynamic Send Port to send data to a File share. Itinerary2 uses a Dynamic Send Port to send e-mail. In the past, Dynamic send ports execute in the adapter's default host. Itinerary1 is designed to target a low volume - big message size scenario. Itinerary2 targets a high volume - small message size scenario. Since there is only one default host for an adapter, all messages are routed using the same host, decreasing the performance.

The Change
To improve the performance of Dynamic Send Ports, an adapter Send Handler is configurable to use any host. In the ESB scenario, Itinerary1 uses HostA to send data to a File share. Itinerary2 uses HostB Port to send e-mail.

     
With BizTalk Server 2013, a new feature will be added allowing a send handler to be assigned for each dynamic send port, bringing it in line with the functionality of static send.

Viewing the Artifact Dependencies
     A possible cause of frustration when dealing with larger BizTalk applications, or applications with a large number of artifacts, is determining what dependencies exists between artifacts.  For example which ports an orchestration depends on, or which maps a port is using the transform messages.

      With BizTalk 2013, a new feature has been added to easily show all of the dependencies between artifacts.

     A BizTalk Server application may contain a bunch of artifacts such as send ports, receive locations, orchestrations, schemas, transforms, etc. Moreover, sometimes these artifacts can be shared between more than one BizTalk Server application. So, it becomes very difficult for BizTalk Server admins to come up with a “dependency tree” that provides information on both the aspects of dependencies, which are:


  • How a given artifact “uses” other artifacts.
  • How a given artifact is “used by” other artifacts.

Pick an artifact in the BizTalk Server Administration console, for example, a receive location. Right-click the artifact, and select View Dependencies.


There’s a new Dependency Statistics pane at the bottom of the page that now lists the dependencies, categorizing it as Used by (which artifacts use this receive location) and Using (which artifacts are used by this receive location). This is how the pane looks like


The Dependency Pane shows that the ReceiveOppNotification receive location is used by one Receive Port and receive location in uses two pipeline components.  Notice that the numbers are links, so you can click those to see the dependent/dependent on artifacts. So, if I click on the number 1 above, the top pane will refresh to show the receive port that uses the ReceiveOppNotification receive location. Similarly, if I click on 2, the top pane refreshes to list the two pipelines that are used by the receive location.


     This feature should really be helpful for BizTalk Server Admins in tracking what other artifacts might get affected if they update a schema, for example. All this while the admins had to manually document all these dependencies but with this enhancement, hopefully it should become much simpler for them.

ESB Toolkit included ‘Out of the Box’
     In previous versions of BizTalk Server, the Microsoft BizTalk ESB Toolkit has been a separate installation and required its own  configuration procedure that took a considerable effort in order to correctly install and configure.  In BizTalk 2013, the ESB Toolkit installer is contained within the BizTalk 2013 installation media, and can be installed from the start menu.   Most of the remaining configuration is the same as in the previous version, however some of the ESB Toolkit configuration steps have been streamlined.