Wednesday, December 23, 2015

Publishing a ASP.NET 5 Web-Application to IIS Locally



I ran into few issues and discovered some kinks in publishing the new ASP.NET 5 Web-Application to an Internet Information Services (IIS) on the local box and then accessing it from other devices on the same network.

While there may be a number of different ways of doing this, the following worked for me.

Visual Studio

After you have create a new Project using File > New Project > ASP.NET Web Application

image

Change the build to use x64 and not ANY CPU

image

Now Right click on the project and choose publish. We will use File System publishing to push the output to a folder location and then get IIS to load it

image

Publish target is inside default IIS web root folder. This might be different for your setup.

clip_image001

Use 64 bit release in settings
clip_image002

Finally publish it

clip_image003

So with this step done your web application is now published to c:\inetpub\wwwroot\HomeServer

IIS

Now launch the IIS Manager by hitting Win key and searching for IIS Manager

Right click on default web-site and use Add Application.

clip_image001[7]

Create and point the application to the published app. Note that this is not the top level c:\inetpub\wwwroot\HomeServer, but rather the wwwroot folder inside it. This is required because the web.config is inside that folder. So we use c:\inetpub\wwwroot\HomeServer\wwwroot

clip_image002[7]

Hit, OK to create the web-app and then restart the web-site

clip_image003[7]

Now browse to the web-site, which in my case is http://localhost/HomeServer

clip_image004

Accessing from local network

To access the same website from other devices on the same network you need to enable access through the firewall. Search and select (Win key and type) “Allow an App Through Windows Firewall” then in the Control panel window that opens (Control Panel\System and Security\Windows Firewall\Allowed apps), click the “Change Settings” button and then check “World Wide Web Services”

image

Find the local servers IP by running the ipconfig command in command shell. Then you can reach this from other devices on the same network.

Screen shot of accessing the web-site from my cell phone connected to the same network over wifi.

clip_image006

Wednesday, November 18, 2015

Dual Booting Ubuntu and Windows 10

Even though I hit a ton of online resources outlining the details, I struggled a lot getting this to work. So in this blog I am outlining what worked for me.

My setup was a office laptop (Lenovo X1 Carbon) with Trusted Platform Module (TPM), secure boot and Bit-locker enabled. My goal is to dual boot Ubuntu 15.10 with Windows 10.

Setup the installer USB

Get a USB thumb drive and format it as FAT32. NOTE: Do NOT use NTFS, otherwise the installation will completely fail with Kernel Panic

image

I downloaded my Ubuntu 15.10 from http://www.ubuntu.com/desktop. Then I downloaded the Universal USB Installer from http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/. I used the following setting to create the installer pen drive

image

Setup your PC for Dual Boot

If you do not have secure boot (UEFI or bitlocker) life is simple. But if you are reading this blog, then definitely you are not in that boat.

First of all disable boot-locker before making any changes into startup settings. Just type Bitlocker in the search box and choose Manage Bitlocker. In that turn it off.

image

Also ensure you have a empty partition to install Ubuntu onto. If you do not you need to partition your disk. There are various freeware and even Windows Disk Management can do that for you. I have the following D drive that I intended to install Ubuntu onto

Capture

Disable Secure Boot

From WinKey+R run the command

shutdown.exe /r /o /f /t 00

Windows will restart with the following screen, choose Troubleshoot

20151112_200310

In the next, advanced options screen choose UEFI Firmware settings

20151112_200348

The use the restart button

20151112_200423

This will bring up the BIOS window. It will differ for different PC/Laptop, but in any case you need to disable various secure boot options. In my Lenovo Thinkpad, I followed the following screen.

Go to Security –> Secure Boot and Disable Secure Boot

20151112_201347

20151112_201409

Then in startup enable legacy boot.

20151112_202504

Save the changes and exit (F10) and boot into windows

Installing Ubuntu

Now in Windows run the same command as before

shutdown.exe /r /o /f /t 00

This will bring up the following options, choose “Use a Device”

20151113_180925

In that use “Boot Menu”

20151113_180946

If you have done everything right the machine will restart and offer a boot menu with your USB thumb drive listed as an option.

20151113_181034

Selecting the bootable thumb drive should launch Ubuntu installer. Choose Install Ubuntu to start installing. Follow through the installer wizard.

20151113_181101

Once you have installed Ubuntu and dual boot is set, you can boot into Windows and then enable Bit-locker.

Thursday, October 22, 2015

How to add a breakpoint in a managed generic method in windbg (sos)

Milkyway over Mt. Rainier

This is not really a blog post but a micro-post. Someone asked me and since I couldn’t find any post out there calling it out, thought I’d add

If you want to add a breakpoint to a managed method inside windbg using sos extension, the obvious way is to use the extension command !bpmd. However, if the target method is generic or inside a generic type it is slightly tricky, you don’t use <T> but rather `<count of generic types>

So I have a the following inside by foo.exe managed app

namespace Abhinaba
{
public class PriorityThreadPool<t> : IDisposable
{
public bool RunTask(T param, Action<t> action)
{
// cool stuff
}
}
}

To set breakpoint in it I use the following (notice the red highlighted part)

!bpmd ApplicationHost.exe Xap.ApplicationHost.PriorityThreadPool`1.RunTask

Thursday, October 15, 2015

Backlight and detergent

imageI found a cheap $6 black light (or rather UV) flashlight on Amazon. Once it arrived, me and my daughter went out on the quest of finding what glows best in it. Basically some sort of phosphor that absorbs the UV light and emits visible light making it seem to glow in the dark.

Based on a quick bing.com  search we tried a bunch of stuff, but what worked best is laundry detergent. I knew that to make clothes seem bright these have phosphors in them. The indirect proof was how bright a newly laundered T-shirt was glowing. Until I popped open one of the Costco laundry detergent pods and put it under UV light I never could’ve guessed the intense glow they emitted.

Enjoy a video of that.

Wednesday, April 01, 2015

List of Modules loaded

While working on the .NET Loader and now in Bing where I am right now working on some features around module loading I frequently need to know and filter on the list of modules (dll/exe) loaded in a process or on the whole system. There are many ways to do that like use GUI tools like Process Explorer (https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) or even attach a debugger and get the list of loaded modules. But those to me seems either cumbersome (GUI) or intrusive (debugger). So I have written a small command line tool. It’s native and less than 100kb in size. You can get the source on GitHub at https://github.com/bonggeek/Samples/tree/master/ListModule or the binary at http://1drv.ms/1NAzkvy.

The usage is simple. To see the modules loaded in all processes with the name note in it. You just use the following

F:\GitHub\Samples\ListModule>listmodule note
Searching for note in 150 processes

\Device\HarddiskVolume2\Program Files\Microsoft Office 15\root\office15\ONENOTEM.EXE (8896)
========================================================
(0x00DB0000) C:\Program Files\Microsoft Office 15\root\office15\ONENOTEM.EXE
(0xCBEF0000) C:\windows\SYSTEM32\ntdll.dll
(0x776D0000) C:\windows\SYSTEM32\wow64.dll
...

\Device\HarddiskVolume2\Program Files\Microsoft Office 15\root\office15\onenote.exe (12192)
========================================================
(0x01340000) C:\Program Files\Microsoft Office 15\root\office15\ONENOTE.EXE
(0xCBEF0000) C:\windows\SYSTEM32\ntdll.dll
...

\Device\HarddiskVolume2\Windows\System32\notepad.exe (19680)
========================================================
(0xF64A0000) C:\windows\system32\notepad.exe
(0xCBEF0000) C:\windows\SYSTEM32\ntdll.dll
(0xCB7D0000) C:\windows\system32\KERNEL32.DLL
...


The code uses Win32 APIs to get the info. This is a quick tool I wrote, so if you find any bugs, send it my way.