Jeff Putz – Repositories gone wild

One of the very beneficial side effects of the rise of MVC in the ASP.NET world is that people started to think a lot more about separating concerns. By association, it brought along more awareness around unit testing, and that was good too. This was also the time that ORM’s started to become a little more popular. The .Net world was getting more sophisticated at various levels of skill. That was a good thing.

via Jeff Putz – Repositories gone wild.

Searching with the Office 365 APIs – Richard diZerega

Today, Microsoft quietly launched the “search” permission scope in Azure AD Applications. This is huge step in delivering new scenarios with the Office 365 APIs that leverage SharePoint search and the Office Graph. In this post, I’ll illustrate how to leverage search with the Office 365 APIs and use it to query site collections and modern groups a user has access to (a difficult/impossible task with the Office 365 APIs until today).

via Searching with the Office 365 APIs – Richard diZerega’s Blog – Site Home – MSDN Blogs.

Run ASP.Net (vNext) Application on Linux with Docker

While surfing MSDN blogs today early morning, I saw this blog post about hosting ASP.Net application in Linux virtual machine in Azure. After I read this great blog post, first thing came to my mind was why don’t I install Linux locally on a VM and try the same scenario. In this blog post I’ll describe step by step installation and configuration of Ubuntu, Docker and run ASP.Net application in it.

Download Ubuntu iso image. Using this image you can create Ubuntu VM either using VMware Player/ Workstation or Hyper-V. In my case I used Hyper-V. It doesn’t matter what hypervisor you use, only woking Ubuntu VM/ machine needed.

You can update your VM to latest version if needed after the installation, since I like to use latest updates, I installed all updates to my VM.

Install Docker on Ubuntu

You can read full article about intalling Docker on Ubuntu from this link. I extracted the necessary information from it and stated it below.

1. Check whether APT can work with https URLs, if not install apt-transport-https.

2. Add Docker repository to your local keychain

3. Update your repository and install Docker

Please go through this tutorial for get more information about installing Docker in Linux.

After finish installing Docker, when you run docker you should get output as below screen.


Prepare Docker container

1. I’m going to use vNext ASP.Net project at GitHub.

2. Create Dockerfile and add content specified here.

From above code it does following things.

  • FROM microsoft/aspnet Get the base image for ASP.Net from Microsoft
  • COPY . /app Copy content of current folder (HelloWeb) to /app directory of the container
  • WORKDIR /app This sets current working directory to /app folder
  • RUN ["kpm", "restore"] Download all the dependencies of the application
  • EXPOSE 5004 Informs Docker that the container will listen on the specified ports at runtime. Docker uses this information to interconnect containers using links and to determine which ports to expose to the host.
  • ENTRYPOINT ["k", "kestrel"] ENTRYPOINT command is used to keep the container as executable. In this case, it’ll start kestrel server which will host ASP.Net site.

Build and run container image

1. Run Docker build command to build the image

2. Check available Docker images

3. Run Docker container

  •  -t switch attaches a pseudo-tty to the container (this switch will not be necessary in future versions of ASP.NET 5).
  • -d switch runs container in background.
  • -p switch maps local 80 port to 5004 port in container.
  • myapp is the Docker image we are going to use

4. See currently running containers

5. Goto http://localhost from browser



Now you have a ASP.Net vNext site running on Linux with Docker. 🙂

Try it out and let me know what happen. Happy coding!! 🙂

Open GitHub HTML/JavaScript project in Visual Studio 2013

Early morning today, it came to my mind that I never used GitHub integration for Visual Studio in my life. With lots and lots of energy, I started to google about the topic. After going through few results I ended up with reading and trying out Rick Rainey’s blog, it is a really good blog post which summarise all the information needed to start and work with project on GitHub with Visual Studio.

But for me, I wanted to do a slightly different thing, I wanted to fork the jQuery project in GitHub and open it from Visual Studio. Really unlucky for me, this project didn’t have a Visual Studio solution file to open it. I had to create a new solution and the relevant projects which were needed. These are the steps I followed in order to accomplish this goal.

1. Fork JavaScript (in my case, jQuery) project from GitHub

2. Clone the project to the local machine, this will download project to given path. Copy the project path before click clone, this will help you in next step.
When you double-click on the project, you will notice that there aren’t any Visual Studio solutions for the project.

3. Goto File->New Project, search for “blank solution”. Paste path you copied in last step to the location and cut last folder name from it and paste it to solution name. In this way, it’ll add a solution file inside the cloned folder. Select “Add to source control” and create new solution.

4. Now you have a new solution without any content to work with. Now you can add either the whole GitHub project as one project to the solution or you can identify parts of it and create separate projects for those. Next I’m going to create multiple projects for separate sections of the project. Right click on the solution, Add->Existing Web Site. Select folder you consider as section of the project.
Now you have Visual Studio solution for GitHub JavaScript/HTML project.

Happy coding!! 🙂

Azure + WordpPress + WP Super Cache: 502 – Web server received an invalid response while acting as a gateway or proxy server

While I’m working on my new blog (this blog 🙂 ), I started to face an issue. In random instances, I started to get this error from the browser.

First I thought this is an issue on Azure and tried to find a fix for it. But I couldn’t able to find any clue which points this issue to Azure. When I searched little bit more about it, I found that it’s issue in WordPress cache or cache configuration.

I found this blog for fix same issue when you use WP Total Cache but it didn’t help me as I expected because configuration of these two plug-ins were very different.

Finally I found a solution from MSDN Forums, and after I changed the settings as it said, I was able to get rid of this issue. Required changes are as below:

  • Go to WP Super Cache Settings page
  • Go to Advanced Settings
  • Uncheck “304 Not Modified browser caching. Indicate when a page has not been modified since last requested.”
  • Uncheck “Extra homepage checks.”

This solved the above mentioned issue for me. 🙂