Friday, July 22, 2016

Visual C# Technical Guru - June 2016

Another month as a judge in Microsoft TechNet Guru Awards under Visual C# category. The TechNet Guru Awards celebrate the technical articles on Microsoft TechNet.

Post in WikiNinjas Official Blog,
https://blogs.technet.microsoft.com/wikininjas/2016/07/21/june-2016-technet-guru-winners/
image
Visual C# Technical Guru - June 2016
Happy Coding.

Regards,
Jaliya

Friday, July 15, 2016

Session : ASP.NET Core 1.0 : What’s New with Web API at Sri Lanka .NET Forum

Yesterday delivered a session at Sri Lanka .NET Forum monthly meetup. The session was titled as "ASP.NET Core 1.0 : What’s New with Web API". It was a house full session with attendees over 70.

Some of the attendees were new to ASP.NET Core and had to give them a brief on .NET Core and what ASP.NET Core really is. I didn’t have any slides, the total one hour session was filled with demos and of course there were a lot of questions during the session and after. As a summary following is what I have discussed and demoed.
  • ASP.NET Core Overview
  • ASP.NET Full Framework vs ASP.NET Core
  • ASP.NET Core Startup Class
  • Routing (Attribute and Centralized)
  • Formatting
  • Swagger
You can find the sample code used in the demo in GitHub.
   AspNetCoreWebApiOverview

For more information,
   Meetup Event

Happy Coding.

Regards,
Jaliya

Thursday, July 7, 2016

Deploy ASP.NET Core 1.0 Web Application inside a Virtual Directory of an Existing App Service on Microsoft Azure

In this post let’s see how we can deploy ASP.NET Core 1.0 web application inside a virtual directory of an existing app service on Microsoft Azure. Let’s start from very scratch and that's by creating two ASP.NET Core applications.

So I have created following two applications, one is ASP.NET Core Web Application and the other is ASP.NET Core Web API Application.

image
Solution
Now what I am going to do is deploy Web App as a App Service, create a virtual directory there and then deploy the Web API application under the virtual directory. Idea is accessing the Web App and Web API as follows.
Assuming you have basic knowledge of deploying a web application to Azure, I am not going to go through those steps. Now I have deployed my Web App.

Next step is creating a virtual directory beneath that. For that navigate to created App Services' Application Settings as follows.

image
App Service
Now in the Application Settings blade, scroll to the bottom and add a virtual directory as follows. Make sure to tick Application check box.
image
Virtual Directory
That’s pretty straight forward. Next step is to publish the Web API application. Before that we need to modify the Route Token in the controller removing the “api” as follows.
image
Route Token
Now let’s publish the Web API application. For that you need to make sure you change the publishing profile as follows. (You can import the same publishing profile that you have used for the Web App or you can just select Microsoft Azure App Service in publishing dialog and follow the steps)

image
Publishing Connection Information
Here as you can see, I have appended “/api” (my virtual directory name) to the Site name and Destination URL. Now  I am all good and I can continue with the publishing. And once the Web API application is published, you will most likely see this error.

image
Error
That is because in the web.config file in the Web API project, you have the following line.

image
web.config
Just remove it and publish the file. Here I strongly prefer editing the web.config through FileZilla or some FTP client. And that’s it. Now you should be able to see the API endpoint working.

image
ValuesController

Tuesday, July 5, 2016

Text Analytics Bot using Microsoft Bot Framework and Microsoft Cognitive Services

You can use Microsoft Bot Framework to create a Bot or rather conversation agent using C# or Node.js. The nice thing is you can use Bot Connector (which is a component of Bot Framework), to integrate your Bot with text/sms, Office 365 mail, Skype, Slack, and some other services.

I have been playing around with Bot framework and built this Text Analytics Bot and it's powered by Language Understanding Intelligent Service (LUIS) and Text Analytics API which is available with Microsoft Cognitive Services. It is still under development and the complete source code is hosted in GitHub.

Currently you can initiate the dialog by greeting to the bot. As this bot is still learning his stuff out, currently you can only submit feedback for an event, forum etc. You can trigger that intent by sending something like "submit feedback, share feedback etc". Currently this bot is integrated with Skype, Slack and Facebook.
SNAGHTML132ab81e
Sample Conversation
Take a look at the following sample.
image
Sample Conversation
Bot is just smart enough to extract information and to know that whether it received all the necessary information at one go. Then he shouldn't be asking any more questions. Isn't it just great.

Just give it a try,
   Text Analytics Bot

And please do contribute to the project.

Happy Coding.

Regards,
Jaliya