Wednesday, 20 March 2013

Hosting Your Own NuGet Feeds

Just spent the best part of half a day, banging my head against the wall trying to get the NuGet push and pull operations to work.

The problem

Any operation either resulted in a 500, or 404 error.

NuGet.exe install MyProject.Platform -source http://mynuget.local:10418/NuGet -OutputDirectory c:\temp

The remote server returned an error: (404) Not Found.

Very annoying, and hardly the quick-n-easy solution its supposed to be.
Any how...

In the end, it turned out to be this


But, I had tried the following articles previously with no success


The solution

In addition to the above link, I thought I'd keep a record of how IIS7.5 does things differently:

  1. Click "Add Wildcard Script Mapping"
    1. Request path = *
    2. Executable = c:\windows\\framework64\v4.0.30319\aspnet_isapi.dll 
    3. Name = Whatever you like
After this, I'm pleased to say, my wasted morning was over finally over.

NuGet.exe push c:\Temp\Platform. -source http://nuget.local:10418/

Pushing Platform to 'http://nuget.local:10418/'...
Your package was pushed.

NuGet.exe install Platform -source http://nuget.local:10418/Nuget -OutputDirectory c:\temp
'Platform' already installed.

Monday, 18 March 2013

Make server unavailable gracefully using Powershell in ARR

Another tidbit for those of us using the ARR framework under IIS.

I've had cause over the last few weeks to manipulate the ARR properties using Powershell. Some of this is covered by the WebFarmSnapIn, but much of it still is not.

Today, I found the missing link for manipulating the entire ARR property schema, and invoking the methods container therein.

Below, is a copy and paste of that forum post in case it ever goes offline.


$mgr = new-object Microsoft.Web.Administration.ServerManager
$conf = $mgr.GetApplicationHostConfiguration()
$section = $conf.GetSection("webFarms")
$webFarms = $section.GetCollection()
$webFarm = $webFarms[0]$servers = $webFarm.GetCollection()
$server = $servers[0]$arr = $server.GetChildElement("applicationRequestRouting")

Simple queries

$counters = $arr.GetChildElement("counters")
We now have everything we need to have some real fun! To get the health status of the server we can do
All the counters can be listed with that
$counters.Attributes | Format-List

Changing state

That is all real cool but we also want to change the health status of a server
$method = $arr.Methods["SetHealthy"]
# $method = $arr.Methods["SetUnhealthy"]
Get the instance of the method
$methodInstance = $method.CreateInstance()
Execute the method
We can also change the state of the server
Get the method we want
$method = $arr.Methods["SetState"]
Get the instance of the method
$methodInstance = $method.CreateInstance()
Set the input value
$methodInstance.Input.Attributes[0].Value = 0
Execute the method
So far I've seen that these input values yields to :
0 -> Available
1 -> Drain
2 -> Unavailable
3 -> Unavailable
2 and 3 yields to Unavailable so I guess one is for "Make Server Unavailable Gracefully" and the other is for Make Server Unavailable Immediately"

Thursday, 14 March 2013

Updating TFS workspaces after a username change

Just lost a couple of hours to a curious issue with TFS.
Due to a recent brute-force hack attempt, we had to change all our AD user accounts to something more sophisticated are more resilient to dictionary attacks.
However, the change of user names caused some issues with TFS.
One of our developers found this magic bullet

tf workspaces /updateUserName:OldUserName /s:http://silo18tfs:8080/tfs/defaultcollection

Problem solved.