Recruitment

I have been interviewing for a while, for my team for other teams…etc, most of the applicants are more than apt with their technical skills and logical reasoning, if you are still not sure about their technical skill set ask them to do a quick hands on exercise or ask them give a code walkthrough of their github project.

But how do we decide on who to hire? what we should be asking ourselves is “would I have him on my team” if you answer yes then nothing else matters just go ahead and select him. Technical skill can be worked upon if the applicant is a good fit for you team and yes apart from their skill set your gut feeling does matter.

Azure API Management Versions Vs Revisions

With the new Version and Revision features its confusing on when to use revisions or versions, my take is as follows

When should you use  Revisions:

  • If you want to do changes that are above your backend services, for example using policies.
    • Add authentication: your api did not have any authentication and you want to have one without disturbing your existing service, so you would add that in the in the new revision
    • Logging: you api did not have any logging of incoming and outgoing requests and you don’t want to disturb your backend service so you create a revision for that feature
  • Note: only 1 revision is exposed to the outside world

When should you use Versions:

  • Use versions when you introduce a breaking change in your api and deploy it as a new backend server and want to support both those deployments.

Increase Timeout for ASP.NET Core applications

Recently we came across a situation where in we had to increase the timeout of a aspnet web application, by default an aspnet core project does not generate a web.config file and did not find enough documentation on how to modify the appsetting.json file.

 

Google always ended up showing on how to do that in a web.config, which we did not have. After playing around we found that we could add a web.config to the solution

 

 

And add the following, there might be better ways of doing it, but wonder why Visual Studio (using 2017) does not add a web.config file automatically ?? maybe another blog post.

 

  1. <?xml version=“1.0” encoding=“utf-8”?>  
  2. <configuration>  
  3.   
     
  4.   <!– To customize the asp.net core module uncomment and edit the following section.   
  5.   For more info see https://go.microsoft.com/fwlink/?linkid=838655 –>  
  6.     
     
  7.   <system.webServer>  
  8.     <handlers>  
  9.       <remove name=“aspNetCore”/>  
  10.       <add name=“aspNetCore” path=“*” verb=“*” modules=“AspNetCoreModule” resourceType=“Unspecified”/>  
  11.     </handlers>  
  12.     <aspNetCore processPath=“%LAUNCHER_PATH%” arguments=“%LAUNCHER_ARGS%” stdoutLogEnabled=“false” stdoutLogFile=“.\logs\stdout”   
  13.                 requestTimeout=“00:20:00”/>  
  14.   </system.webServer>  
  15.     
     
  16. </configuration>  

The new Azure CLI – 2.0, The term ‘az’ is not recognized as the name of a cmdlet

Couple of interesting changes that MS has done are

  1. To switch from node to python
  2. And the other is “az configure”

az configure lets you choose the output you want and some other features like logging, sending usage info, all in all a great cli tool.

 

While installing the tooling, I ran into the following issue

az : The term ‘az’ is not recognized as the name of a cmdlet, function, script file, or operable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ az

+ ~~~~~

+ CategoryInfo : ObjectNotFound: (az:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

Per the website https://docs.microsoft.com/en-us/cli/azure/install-azure-cli#windows there is a Note asking to do this

Add %APPDATA%\PythonXY\Scripts to your PATH. Where X.Y is your Python version (for example, %APPDATA%\Python27\Scripts).

However on my machine I had to append another “Python” to get it running and by the way I installed python 3.6

%APPDATA%\Python\Python36\Scripts

 

 

Generating swagger for azure functions until its available OOB

Please follow the steps below to generate swagger for Azure functions

  1. Get a fiddler/postman session working with your function so that you have the json ouput.
  2. Past the Json as class using the following in Visual Studiopastedimage
  3. Create a webapi application, configure swagger (the howto can be found here https://www.youtube.com/watch?v=LIhT6HIpLf8)and create a controller method with the necessary input and output values (no method implementation is necessary except for returning expected output)
            // GET api/values/5
    public List<Rootobject> Get()
    {
    return new List<Rootobject>();}
  4. Then just navigate to  http://yourapplication:portno/swagger  to make sure all the datatypes for your particular operation are shown accordingly.
  5. Then download the swagger file from http://yourapplication:portno/swagger/docs/v1  and save it to a file
  6. Then navigate to http://editor.swagger.io/#/ open the saved file (copy paste also works) and  add or remove what you need….

Hopefully this will help in saving some time…

Await methods are not supported in catch and finally block for .Net 4.0, solution ExceptionDispatchInfo

If you are using .net 4.5 and use async/await you will realize that you cannot await in the catch block, the new C# 6 language overcomes this limitation.

 

in .Net 4.5 you can us the ExceptionDispatchInfo to capture the exception and throw as required, example below

———————————————————————————————————————————————————

ExceptionDispatchInfo capturedException = null;

try
{
SomeMethodCall()
}
catch (Exception ex)
{
capturedException = ExceptionDispatchInfo.Capture(ex);
}
if (capturedException != null)
{

await LogExceptionMethod(), //log exceptions to an external endpoint

}

throw exception;