I'm migrating from one computer to another and in order to serve up my web app locally IIS requires some handler mappings in order to serve .svc
extensions. I found on the new computer I'm missing those mappings. I'd like to script the creation of these mappings so that it's reliably repeatable. I found there's a powershell command Get-WebHandler
and New-WebHandler
. I was hoping I could get the hanlder mappings from the remote (old) IIS instance and pipe that into the new hanlder command.
Can I reference a remote IIS machine with Get-WebHandler
or is there another command I would use to get IIS settings that I would then pipe into Get-WebHandler
?
The
*-WebHandler
cmdlets don't work against a remote server, so you can not pipe existing handlers intoNew-WebHandler
.There are some hacks you can do:
Copy the node from ApplicationHost.config on the old server to the new server.
Get the output from
Get-WebHandler
into a csv file. Use that file to create new handlers on usingNew-WebHandler
. This requires some coding.Create a PowerShell script from scratch to create your custom handlers with
New-WebHandler
. You could use pipe the output ofGet-WebHandler
from both servers into a text-file and do a Diff, so you can find what is different.Move custom handlers into the web.config of your site and the copy the site.