Thursday 25 July 2013

NHibernate

NHibernate Pitfalls: http://weblogs.asp.net/ricardoperes/archive/2011/06/17/nhibernate-pitfalls-index.aspx

Wednesday 17 July 2013

Web API Formatters

     public static class FormattersConfig
    {
        public static void Register(HttpConfiguration config)
        {
            #region Json Formatter

            // Default formatter is Json Formatter
            // Default Json Formatter uses Json.Net
            // You can change the Json Formatter to use DataContractJsonSerializer
            config.Formatters.JsonFormatter.UseDataContractJsonSerializer = true;

            // How to Remove?
            config.Formatters.Remove(config.Formatters.JsonFormatter);

            #endregion

             #region Xml Formatter

            // Default Xml Formatter uses DataContractSerializer
            // You can change the Xml Formatter to XmlSerializer
            config.Formatters.XmlFormatter.UseXmlSerializer = true; 

            // How to Remove?
            config.Formatters.Remove(config.Formatters.XmlFormatter);

            #endregion

            #region Custom Formatter, custom Xml, comma delimited values, etc

            // Create CustomFormatter class which extends MediaTypeFormatter class.
            // Then call config.Formatters.Add(new CustomFormatter());
            // http://serena-yeoh.blogspot.co.uk/2013/02/aspnet-web-api-custom-formatter.html#!/2013/02/aspnet-web-api-custom-formatter.html

            #endregion
        }

Friday 12 July 2013

AngularJS

You can access the presentation at: http://prezi.com/hzn2dxxwhdr2/angular-presentation/?utm_campaign=share&utm_medium=copy



The Screencast is at: http://www.youtube.com/watch?v=eXHPmbAFiiw



You should be able to run https://github.com/mflerin/angularjs-basics on your pc without any problems (this is the code that accompanies the screencast)



The rest of the source code is at: https://github.com/mflerin/node-angular-infrastructure this requires mongodb and nodejs to run. You can install these on your pc but it requires a bit of work.



Friday 5 July 2013

Web API and Tracing

We wrote our custom request/response logger for our Web API project so that we can analyze and monitor all the inputs and outputs whereas there seems to be a built-in tracing feature in the Web API:

http://blogs.msdn.com/b/roncain/archive/2012/04/12/tracing-in-asp-net-web-api.aspx

I'll try it for my next Web API project!

Tuesday 2 July 2013

How to control the Request Size and Execution Timeout


Limiting the Request

You can apply the below limits on the request:

  • Request size; default is 28.6MB in IIS 7.0 and 4MB in IIS 6.0. Please see below.
  • Request header size
  • Url length; default is 4KB
  • Query string length; default is 2KB
http://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits

Request Size

If content size exceeds 1024 bytes then throw 404.13 error:


  
    
      
        
          
            
          
        
      
    
  



IIS 6.0:


  
    
    
    
  



IIS 7.0:

  
    
      
      
      
    
  




Request TimeOut


  
  
  




  
    
  




Max Response Size

• Response size by default doesn’t have a limit from the server point of view.

• The client, however, can limit the response size by setting “content-length” in the request header.

• If very large data required, we should be considering compressing the data or returning binary data. How large is very large?! Perhaps above 50MB.