Wednesday 7 October 2015

The Latest Development About Angular Js That You Have To Know.

In this post we are going to see the new features present in the Angular 2, and the differences between the version 1.x and 2.0

First of all, i don't knew who is the person recommends the Angular 2 with, this kind of major changes, now currently angular 1.x versions are have a good popularity among the developers which is very easy to develop a single page applications. angular 1.x versions have many major advantages which makes that popular among the industry.

Features:
1. Two way binding
2. Routing
3. Change Detection
4. Directives
5. Services.
6. Controllers and the Scope concept.

Mainly the Two way binding makes the good feedback among the developers to develop the UI far better than any other framework. But recently google decide to soon release the angular 2 which have some major break changes in the framework.  Google and Microsoft are jointly working in the angular 2 framework,  angular 2 uses Typescript. 

Changes or features present in Angular 2

1 .No more Two way binding
      The major change is there is no more two way binding present in angular , all are uni directional, actually the thing which makes the angular popular among the industry in Two way binding ng-model, i.e is no more present in the up coming release. Angular team clearly indicates that unidirectional flow of data will be present in the angular 2., Here after there is no more $digest loop every time when ever a two way binding occurs.

2. New Router:
      The new release consists of a new router concepts.

3. No $scope
       Hereafter there is no concept called $scope , for a newbie to learn the concept of $scope is difficult, so to avoid the difficulties in learning they removed that concept

4. No Controller
       Angular 2 remove the concepts of controller , rather they uses the concept called web components where every component consists of View, component and class implementation.


@Component({
  selector: 'emp-view',
  componentServices: [
    emplist
  ]
})
@Template({
  url: './templates/emp-view.html',
  directives: [Foreach]
})
class EmpView{
  constructor() {
    this.employees = emplist.get();
  }
  addEmp(newemp) {
    this.employees.push(newemp);
  }

}

5. Fast change detection:
     Angular team changed the change detection mechanism for the newer version, new version refers many libraries implementation about change detection so angular team decided to give a optimized change detection.

6.Written in Typescript
   Angular 2 is written in Typescript , Typescript is statically typed language, so we can get the type errors in compile time itself , typescript is a superscript of ES6, ES6 is a superset of ES5. which are being transpiled to javascript

7 Virtual Dom concept 

8. Improved Dependency Injection

9. supporting mobile

But angular 2 doesnt have a backward compatibility support, so  many applications which are developed in version 1.x can use that if there is no performance issue, because if they want to change or migrate to version 2.0 then it is a huge cost for them, it is better to have a library which have more features than compact small performance increase.
From my concern google destroying the growth of  angular by giving a major change especially in removing of two way binding.

From this post you can see some of the changes takes place in the angular 2 version.






Why Is long running Thread Being Aborted in asp.net page is the Most Trending issue Now

Sometimes we are come to face a problem thread being aborted while long running webservice  which is call from a website through soap request.

Why this error is coming while doing a long running process in ASP.Net 2.0 , Answer from the Microsoft is IIS is not designed for a long running processs.

 What makes the running thread to be Aborted in ASP.Net ?
  • while any error is raised in your application, if there is no catch block, because of  UnHandled Exception Thread is begin Aborted abruptly.
  • RoundRobin Request Makes AppDomain to ReCycle.
  • After a IdleTime Out ApplicationPool Automatically Recycles (If there is no more request is received for asp.net page from client more than IdleTimeOut minutes)

   If Recycle  is done by Application Pool, then following are the Reasons   
   will make that happen.
  • IIS may have recycled the application pool for whatever reason.
  • IIS may have restarted
  • Some settings on the server that limits asp.net execution time.
  To Avoid the thread Being Aborted , if it process by Application pool,    
  Increase the Execution Time Out of Web Service
  • Change the web.config file and setting in IIS.
  • Increase the executionTimeOut and application pool ideal time out.

Timeout in Debug mode

          Default script timeout on IIS is only 90 seconds. When you start web application in debug mode it is 300 000 seconds (almost a year). So, timeout errors are visible only when running release code.

Change server timeout in Web.config

              If you want to have an option to change server timeout value later, after code is compiled, one of easy ways is to change it as parameter through a web.config. You can set server timeout with code like this:    Default executionTimeout is 90 seconds.
<configuration>
   <system.web>
      <httpRuntime maxRequestLength="4000" executionTimeout="45" />
   </system.web>
</configuration>
Change Application Pool Ideal Timeout
  1. Open IIS Manager.type inetmgr in run
  2. In the Connections pane, expand the server node and click Application Pools.
  3. On the Application Pools page, select the application pool for which you want to specify idle time-out settings, and then click Advanced Settings in the Actionspane.
  4. In the Idle Time-out (minutes) box, type a number of minutes, and then click OK.

Problem with application restart when running long tasks in ASP.NET

when work with long running tasks. Application could restart because of different outside reasons, and then your long operation is stopped too. The reason can be
  • Change in global.asax file
  • Change in web.config file
  • Change in machine.config file
  • Change in content of bin folder 
  • Add a new folder inside App folder
  • Even some antivirus also reason
Health Monitoring 
How we can find out which makes the Thread being Aborted for ASP.Net ?
  • Health Monitoring : Health Monitoring is the One of the Framework that is forgotten by Asp.Net Developers. It Provides great Monitoring features in Diagnose Failing Application and systems. Asp.Net Errors are placed in system event logs.
  • To Enable that Change in Master Web.Config file which is placed in Dotnet framework installation directory %WINDIR%\Microsoft.NET\Framework\version\CONFIG . From the Config file we removed some markup to show clearly.
 <configuration>
  <system.web>
  <healthMonitoring>
  <eventMappings>
    <add name="All Errors" type="System.Web.Management.WebBaseErrorEvent,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647"/>
    <add name="Failure Audits" type="System.Web.Management.WebFailureAuditEvent,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" endEventCode="2147483647"/>
  </eventMappings>

  <providers>
    <add name="EventLogProvider" type="System.Web.Management.EventLogWebEventProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
    <add connectionStringName="LocalSqlServer" maxEventDetailsLength="1073741823" buffer="false" bufferMode="Notification" name="SqlWebEventProvider" type="System.Web.Management.SqlWebEventProvider,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
  </providers>

  <rules>
  <add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom=""/>
 <add name="Failure Audits Default" eventName="Failure Audits" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" custom=""/>
  </rules>
  </healthMonitoring>
  </system.web>
</configuration>
 
Health Monitoring :
  1. Monitor the health and performance of the application.
  2. Diagnose the application or system failures.
  3. appraise significant events during the life cycle of an application.
  4. Monitor live ASP.NET applications, individually or across a Web farm.
  5. Log events that do not necessarily relate to errors in an ASP.NET application.
the <eventMappings> element assigns the human-friendly name "All Errors" to the health monitoring events of type WebBaseErrorEvent and the name "Failure Audits" to health monitoring events of type WebFailureAuditEvent

The <providers> element defines the log sources,The first <add> element defines the "EventLogProvider" provider, which logs the specified health monitoring events using the EventLogWebEventProvider class. The EventLogWebEventProvider class logs the event to the Windows Event Log. The second <add> element defines the "SqlWebEventProvider" provider, which logs events to a Microsoft SQL Server database via the SqlWebEventProvider class. The "SqlWebEventProvider" configuration specifies the database's connection string (connectionStringName) among other configuration options.

The <rules> element maps the events specified in the <eventMappings> element to log sources in the<providers> element. By default, ASP.NET web applications log all unhandled exceptions and audit failures to the Windows Event Log.
Now change the Web.Config file in your Asp.Net Application
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
    </compilation>

    <healthMonitoring enabled="true" heartbeatInterval="120">
      <rules>
        <add name="Heartbeats Default" eventName="Heartbeats" provider="EventLogProvider"
              profile="Default" />
        <add name="Application Lifetime Events Default" 
              eventName="Application Lifetime Events" 
              provider="EventLogProvider"
              profile="Default" />
        <add name="Request Processing Events Default" 
              eventName="Request Processing Events" 
              provider="EventLogProvider"
              profile="Default" />
      </rules>
    </healthMonitoring>
  </system.web>
</configuration>
After deploy the application , when we launch the application we can see the event log with codes 1001 , 1002 gives information about application start up and shut down. code 1005 traced every 120 seconds (hearbeatinterval = 120).
From this log we can say whether our application is consuming to much memory or queuedin user request.
From This article we can find the various possibilities of Thread Aborting for a long running task,
And Process of Health Monitoring