Problems linking Azure and VSTS?

Posted by on Apr 6, 2017 in Azure, Cloud

I recently hit a minor road-block when attempting to link a VSTS account to an Azure account to do automated deployment upon checkin to a given branch. For some reason Azure simply would not “see” my VSTS account and therefore projects from the portal. After a little bit of searching online I found and followed this article on the Kudo blog. Specifically it states that you need to be at least a project administrator, it must be GIT source controlled project and you need to check if you can create service hooks (to validate the given permissions). All of these were fine so I continued searching. I then stumbled upon this article which solved the problem for me. It seems you also need to be the project OWNER, which I was not. Thankfully, changing ownership is a doddle so I switched owners using the details in the post I just linked to and it still didn’t show up. Finally, I switched back to the old azure portal and tried linking my accounts there. Voila! It worked. Why the new Azure portal couldn’t see the VSTS account I don’t know, but as soon as they were linked in the old portal everything started working in the new one. It seems we may be stuck with two portals for a little while...

Read More »

Setting the deployed project in a multi-project core solution in Azure

Posted by on Nov 16, 2016 in, Azure, Cloud

If you deploy a single project core application to azure everything is about as smooth as it could be. A typical workflow would be to simply create a new web app, set the deployment source (e.g. your git repository) and everything is up and running in a few seconds. If, however, your solution contains multiple projects, how do you specify which project is deployed? Previously this would be done using Azure deployment scripts, but this is a needless effort for such a small task. Just look at the wiki for details on why you may want to avoid this. The preferred way is to specify an Application Setting in the Azure portal. The advantage of this is that you have no deployment code checked in to your source code repository and you can more easily toggle active projects both without deployment and between deployment slots. To do this we need to go to your web app in the portal, click App Settings and create a new App settings key called PROJECT with the path to your project file: However, while this works well with full .net framework applications that use .vbproj and .csproj solutions, at the time of writing core applications still use the soon-to-be-obsolete .xproj system. If you point your app setting to an xproj, you’ll get an error message in the console. A workaround to this is to update the setting to point to the directory of the solution you want to deploy, relative from the root of your source code repository. In .net core land, this is likely to be along the lines of [Solution name]\src\[project name]\ 1 [Solution name]\src\[project name]\ And you can verify this using the very, very handy console (found under development tools in your web app service list). Open the console and cd ..\repository 1 cd ..\repository and from there traverse your way to your folder containing your xproj. Copy that path (from repository onwards) and use this as the app setting: Redeploy your solution, and you should be up and running with your chosen project. Another benefit… Another nice benefit of this approach is that if you use deployment slots, you can toggle projects per deployment slots, making it exceedingly quick to switch projects just by doing a slot-swap in the...

Read More »

Migrating to TypeScript from ES2015 for AWS Lambda

Posted by on Oct 12, 2016 in AWS, Cloud, JavaScript

I was recently building an skill for the Amazon Alexa platform (think Amazon Echo, Fire tablets, Echo Tap etc). Like anyone writing JavaScript today I naturally levitated toward some of the syntactic goodness that ES2015 offers – arrow functions, let variable scoping, string literal templating, default parameters etc all of which make JavaScript a much, much nicer language (and much, much closer to C# incidentally which is where the language seems to be heading long-term looking at current and new functionality. Alas, I digress!). I had the skill up and running locally (bridged via an Express.js node front end for testing) and everything was working well. Then it came the time to upload my skill to the amazon developer portal and migrate my function to AWS Lambda. This is where the fun started – it turns out Lambda uses a fairly dated version of Node.js that doesn’t support much of the ES2015 specification. This left me faced with two options – strip out all the ES2015 code and rewrite using vanilla JavaScript or make use of our friend, Typescript. To be honest I should have gone down the TypeScript route from the offset; in hindsight I’m not sure why anyone would write straight JavaScript nowadays when the TypeScript transpiler does such a great job of both supporting new functionality and also outputting compliant ES5 code. The task of migrating from JavaScript was as easy as 1-2-3: Rename all my .js files to .ts Install tsc from the command line (npm install –g tsc) and create my tsconfig.json with the list of files in my project Run typescript in watch mode (tsc –w) to get it to watch for changes to save (my lazy hands) having to recompile manually Once this was done I was free to do nothing more and I already had fully “Lambda compliant” JavaScript that I could use. However, the TypeScript compiler can do so much more for me, so I spent a little time going through my code adding in types to all my parameters, created an object interface so TS knew the type of data I was passing around on properties on the object (this also greatly improved Intellisense in VS Code I might add) and pulled down some typings for the third party libraries I was using. Migration was such a smooth and painless experience and I’m now in a much better place than I was prior to the conversion. I have compile time type checking, I get to use the much more elegant and succinct ES2015 syntax and I have a much better development environment through the “knowledge” TypeScript now has about my...

Read More »

So what is HTTP/2?

Posted by on Oct 10, 2016 in WebDev

A little background If you’re a web developer (or indeed any developer nowadays) then you really should know HTTP as this is the de facto protocol for client/server communication on the web. HTTP is in essence the TCP/IP protocol for the web using ports 80 and 442 by default (for non-secure and secure communication respectively). HTTP dates back to the late 1980’s and early 1990’s so it’s a mature protocol which was designed long before the modern web app of today. Thus, many conceivable performance enhancements have been proposed over the years that saw things like headers (initially missing from the 0.9 HTTP specification), VERBS (HTTP initially consisted only of GET requests), content types and much more. However, these enhancements were working within the constraints of the original HTTP specification and the HTTP/1.1 was pushed to the maximum. It greatly needed a reboot. And in 2015 HTTP/2.0 was born. HTTP/2.0 is born Through a partnership between Google (and its now deprecated SPDY protocol) and a number of other leading bodies, the HTTP/2.0 specification was drafted which focused on a number of major shortcomings in the HTTP/1.x specification. Primary targets for optimisation included: Prioritise binary content over text Header compression Inherrant security Multiplexing Server-side push Whereas earlier versions of the protocol were purely text based, HTTP/2.0 is a binary protocol consisting of a HEADERS frame and a DATA frame (analogous but not the same as the headers and body in HTTP as you know it today). Frames are grouped into streams. Because of this, only a single TCP connection is required to transmit multiple resources, as various streams can be sent to the client and easily reconstructed using the stream id to decompose frames accurately. Server push With the multiplexing described above, clients can eagerly make several requests for resources knowing the server can send them on the same connection. However, servers utilising a HTTP/2.0 connection can be a little more pro-active and actually push content to the client knowing it will be needed. The server will notify the client that it is performing a server push using a special frame called a PUSH-PROMISE which informs the client that it is sending data that it hasn’t asked for, but thinks it will need. Therefore when the client later realises it needs this resource, it already has it and knows where to get it without contacting the server. Prioritisation With all this lovely asynchronous goodness and pro-activeness on a single stream, it is conceivable that the client could be waiting longer for a resource on a TCP connection as its being intermixed with other content. This has been though of though and clients can tag a request with a priority so that it can later send the server a PRIORTY request frame and switch priority levels of resources being returned, thus allowing it to get the most important content first. Without...

Read More »

IIS: There was an error when performing this operation

Posted by on Aug 30, 2016 in

I recently started setting up a new dev box and a couple of solutions (bound to IIS) simply would not run. In the browser I was getting a 500.19 error while even attempting to open the configuration for the website in IIS greeted me with the completely unhelpful message of: “There was an error when performing this operation” While this message couldn’t be any less useful if it tried, it hinted that the problem was with IIS rather than the website. My initial thoughts were permissions, so after ensuring the IIS_IUSR account had access to the web.config file I next attempted to ensure all additional modules were installed. The missing IIS rewrite module has bitten me I the past so I double checked that was installed – without it this is exactly the error message you would see, which led me to believe another missing IIS addon was at fault. The steps I took to debug this though was to section by section go through my web config removing each section and attempting to load the site and/or let IIS parse the config. When I removed the section pertaining to initialization optimisation this fixed the issue and I immediately remembered that this dependency was added a fair while ago, so much so that I completely forgot about it. Voila, installing the missing module fixed the problem and the site worked fine, plus IIS could now parse the configuration...

Read More »