You are currently browsing the tag archive for the ‘IIS’ tag.

I started teaching myself Docker during my time off December 2016.  I grabbed my dockerUbuntu laptop, loaded up Docker and got to work.  Docker is really easy to pick up and get started with.  I even loaded it up and build a few containers for a Raspberry Pi.  🙂

With Windows 10 and Windows Server 2016, Windows containers are now available.  You can get a base Windows container from Docker hub and run it from one of these OS’s.  Be forewarned, the images made from Windows Core are 10GB in size!  So much for being light. At least you only need to download them once.

I have and old (unfinished) ASP.NET MVC site running at http://brettski.com.  I figured this would be a good candidate to throw in a container since it has no external dependencies, like databases, etc.  It runs on ASP.NET MVC 3 or 4 and dotnet framework 3.5.

For windows base containers there are two bases I have seen from Microsoft: Windows Core and Windows Nano.  Since I haven’t worked with Nano and understand it is really stripped down, I decided to start with Windows Core.

Since the site runs on IIS, I started with the Microsoft/IIS container. The container is a build of Windows Core with web server role added.   I started out with the following Dockerfile for my site which is located at the root of the solution.  I published the site to ./brettski4/pub/release/, so it may be easily mapped in the file.

#FROM microsoft/iis:latest

# copy compiled code into container
# build sent to /pub
RUN mkdir c:\\website
COPY .\\brettski4\\pub\\release c:\\website

WORKDIR c:\\website

# Add features
RUN powershell -Command Add-WindowsFeature -Name Web-Server; \
 Add-WindowsFeature -Name Web-Asp-Net

# Add sites
RUN powershell -NoProfile -Command Import-Module IISAdministration; \
 New-IISSite -Name "brettskicom" -PhysicalPath "c:\website" -BindingInformation "*:8088:"

EXPOSE 8088

ENTRYPOINT ["C:\\ServiceMonitor.exe", "w3svc"]

It’s a really simple Dockerfile. It starts by using the microsoft/iis:latest container image.  It then makes a directory in the container for the site files (c:\\website). Copies those files from the local machine into the container’s new directory, and finally makes the workdir c:\\website, which isn’t really needed for this container.

I needed to add two features to the container, ASP.NET application service and DotNet 3.5 (which isn’t in the file above).  This is the first place I was tripped up as ASP.NET 3.5 cannot be loaded in this container, it’s isn’t an available option!  Either is Dotnet Framework 3.5.  An error is raised that the source files are not available.  I wasn’t sure where to get them on the web, or what exactly was needed to add them (WSIM, etc.).

So sought out a different container.  Looking through the containers in the Microsoft Docker Hub listing I came across microsoft/aspnet.  Which is tagged for two versions: 3.5 and 4.6.2 (which has a few flavors). Going for the microsoft/aspnet:3.5 container image I updated my Dockerfile to add in web-server and asp.net application service.

FROM microsoft/dotnet-framework:3.5

# copy compiled code into container
# build sent to /pub
RUN mkdir c:\\website
COPY .\\brettski4\\pub\\release c:\\website

WORKDIR c:\\website

# Add features
RUN powershell -Command Add-WindowsFeature -Name Web-Server; \
 Add-WindowsFeature -Name Web-Asp-Net45; \
 Invoke-WebRequest -Uri "https://github.com/Microsoft/iis-docker/raw/master/windowsservercore/ServiceMonitor.exe" -Outfile "c:\ServiceMonitor.exe"

# Add sites
RUN powershell -NoProfile -Command Import-Module IISAdministration; \
 New-IISSite -Name "brettskicom" -PhysicalPath "c:\website" -BindingInformation "*:8088:"

EXPOSE 8088 

ENTRYPOINT ["C:\\ServiceMonitor.exe", "w3svc"]

This Dockerfile starts out the same but is a bit different when adding features.  We add Web-Server, and ASP.NET 4.5.  Since this container didn’t come with IIS, Microsoft didn’t add the ServerMonitor.exe executable, I decided to grab it from the GitHub repo and save it in the container.

I am still not 100% sure what ServerMonitor.exe is used for, though it seems to keep the container active after it starts.  From what I have read, people had added useless loops written in powershell to have some type of process running at the start of the container. Running ServiceMonitor.exe while in the container only says, Usage: ServiceMonitor.exe [service name]. So little help there.

So this was my Tuesday, in between other things, getting something to work inside a Windows container.  If you haven’t played with Docker yet, I strongly suggest that you do.  It is quite easy to get started with, and containerization is going to continue to grow as big if not bigger than Virtual Machines did.

The Container image built is in my Docker repository here.

 

On and off for the last couple of months I have been learning Erlang.  My primary source for this is a decent booked named, “Learn You Some Erlang for Great Good!” (Fred Hebért, (c)2013 no starch press). What a great name, no starch press (:  I first found this tutorial online at http://learnyousomeerlang.com/.  The entire book is there, believe it or not.  I worked through the first few chapters and was hooked.  I decided to purchase the book to help pay for the work and for it to be more convenient to read.  But I digress, back to IIS & Mercurial.

Mercurial Logo

The whole reason for the Erlang digression is that I was going through examples in the book on different computers.  After I was done with the session I would have copy my practice files back to my home server, which was a pain on a disconnected Linux box.  To solve this, I figured, why not setup a repo at home.  I have been wanting to do this for a while anyhow.  Now I could setup an SVN repo in a few minutes, but I don’t really use SVN anymore (“It’s so 1990’s (:  ).  Mercurial is my DSCM of choice.  I have nothing against GIT, and do use it, I just regularly use Mercurial.

IIS7 logo

My home server is Microsoft Windows Home Server 2011.  Basically Windows 2008 R2 (IIS 7.5) with some other “stuff” thrown in.  Finding installations for a Mercurial server under Windows is not a simple task.  There are articles out there, most of them are old or incomplete.

This walk-through, http://www.jeremyskinner.co.uk/mercurial-on-iis7/ [Jeremy’s article], is good and walks well through the process.  Unfortunately it is out of date and doesn’t cover well what needs to be installed today to get this to work.  The first part of my pain as things weren’t working.  I am thankful for its explanation of adding CGI support in IIS7, something I haven’t needed to do in IIS7 before.  One thing this article mentions (in bold) is to use x86 installer of Python, even if your machine is 64-bit.  I believe this is no longer accurate as I installing 64-bit Mercurial and 64-bit Python and all is working fine.

For the start of my journey I was using this walk-through along with a few Mercurial wiki pages: http://mercurial.selenic.com/wiki/HgWebDirStepByStep and http://mercurial.selenic.com/wiki/PublishingRepositories.  I was understanding how the publishing works, but not getting things to work on my Windows server.  Mostly my error was around Python not being able to find hgweb stuff.  It was blowing up on application = hgweb(config), and said application undefined. The additional Mercurial installation I needed was located here: http://mercurial.selenic.com/wiki/Download#Windows which I found in a helpful wiki artical, http://mercurial.selenic.com/wiki/HgWebInIisOnWindows.  If you follow this article straight through, you will almost have a successful installation.  What I learned from this page is that the Python module installer needs to be run.  This adds Mercurial modules to Python.  Something which is needed and not specified in the other installation instructions.

If you don’t like the command line, the IIS configuration in the Mercurial wiki article is done through the command line.  You can reference how to do these through the UI using Jeremy’s article.

My suggestion after going though this, this morning is to use both articles.  Read through them first, before installing anything, then plan your attack and go for it. Oh and yeah, you’ll need to refer to the Publishing Repositories wiki page.

New hg site

A few things I learned from this morning’s adventures

  • Within the hgweb.config file the section [collections] is no longer needed, the section [paths] may be used instead.  There is more information around this here: http://mercurial.selenic.com/wiki/PublishingRepositories
  • Within hgweb.config a path of / = /path/to/repo/* will show (publish) all repositories.
  • Withing hgweb.config using allow_push = * allows any user to push to the repository. Using this settings negates the need to enable authentication on the web.  Yes this makes things insecure, but my setup is internal to my house only.

So sure this took a bunch of hours to figure out and get working correctly.  Though now it is working correctly and I have my working Mercurial repository like I have been wanting for some time. Plus I have learned a bunch of stuff too.  Perhaps I’ll go play a game now.

I ran in to an interesting issue yesterday.  In an IIS 6 web server we have a website set to run ASP.NET 4.0.  I was configuring a virtual directory to run under ASP.NET 2.0 to run ScrewTurn Wiki. Our standard config has the DefaultAppPool configured with ASP.NET 2.0 applications which don’t require their own pool.  The wiki was running without issue.  I decided to put the wiki in it’s own pool for various other reasons.

So I proceeded to configure a new application pool templated from DefaultAppPool.  Once the new application pool was assigned to the virtual web I started noticing some strange behavior.  Anytime I requested a URL which didn’t include  a page name my get request would include the file eurl.axd.  For ScrewTurn this means everytime you request the main url, it says it cant find the page named eurl, very annoying.

I wrestled for a while trying to figure out why this was happening.  At first I didn’t realize it had to do with the new app pool.  After a some googling time I cam across a Microsoft article of .NET 4 breaking changes which contained the issue I ran into.  (Very strange, http://www.asp.net is down right now with an error screen…). To test this further I changed another running web application to this app pool (which was running under DefaultAppPool) and it did the same thing, looked for eurl.axd on the request.

The article can be found here: http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#0.1__Toc256770153 and explains why this is happening.  In a nutshell it has to do with the website running ASP.NET 4.0 and virtual webs running ASP.NET 2.0.

What I find very strange about this bug is that as long as I use the DefaultAppPool I don’t have this issue (and yes, the website itself has it’s own app pool).  I only experience the bug when a new app pool is created for the virtual web which is running ASP.NET 2.0.

keys: eurl, eurl.axd,