Showing posts with label iis. Show all posts
Showing posts with label iis. Show all posts

1/17/11

Powershell Appcmd IIS 7 Command Line Tool

Appcmd Objects
APPapplications
APPPOOLapplication pools
BACKUPserver configuration backups
CONFIGgeneral configuration sections
MODULEserver modules
REQUESTHTTP requests
SITEvirtual sites
TRACEworking with failed request trace logs
VDIRvirtual directories
WPworker processes

$appcmd = "c:\windows\system32\inetsrv\appcmd.exe"
&$appcmd /?  #help

#list all sites
&$appcmd list site
&$appcmd list site /xml        #use xml to get attribute names
&$appcmd list site /text:name  #use text to get attribute values

&$appcmd list site /text:name | sort  #ps sort

#list all app pools
&$appcmd list apppool

#list app pool names
&$appcmd list apppool /text:name

#list app pool .net framework version
&$appcmd list apppool /text:managedRuntimeVersion

#list all w3wp.exe worker processes, use to debug match process id to iis website
&$appcmd list wp

#list started sites, running
&$appcmd list site /state:started

#list stopped app pools
&$appcmd list apppool /state:stopped

#list all virtual directory/physical paths
&$appcmd list vdir

#list site bindings ipaddress
(&$appcmd list site prod /text:bindings).split(",")

#list response headers
&$appcmd list config prod /section:httpProtocol

#add response headers
&$appcmd set config prod /section:httpProtocol /+"customHeaders.[name='foo', value='bar']"

#delete response headers
&$appcmd set config prod /section:httpProtocol /-"customHeaders.[name='foo']"
&$appcmd set config prod /section:httpProtocol /-"customHeaders.[name='x-powered-by']"

#output site configuration text
&$appcmd list site prod /text:*

#list website virtual directory/physical path
&$appcmd list vdir prod/

#stop website
&$appcmd stop apppool prod; &$appcmd stop site prod

#start website
&$appcmd start apppool prod; &$appcmd start site prod

#stop all running sites
&$appcmd list site /state:started /xml | &$appcmd stop site /in  

#stop all running app pools
&$appcmd list apppool /state:started /xml | &$appcmd stop apppool /in

#list mime types
&$appcmd list config prod /section:system.webServer/staticContent

v11.09

5/5/10

ASP.NET 4/IIS ManagedPipelineHandler Error

ASP.NET 4 error on Windows 7/IIS 7.5
HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list.

To fix, install ASP.NET 4 using the .NET 4 ASP.NET IIS Registration Tool.
See documentation for differences between the -i and -ir options.
c:\windows\microsoft.net\framework\v4.0.30319\aspnet_regiis.exe -i

4/9/10

HTTP Error Codes 401 and 500 on IIS 7 and ASP.NET

To fix these errors on Windows 7 Pro, add the user group/account to the web folder and set permissions.

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
User Group: IIS_IUSRS

HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.
User Account: IUSR

Permissions:
read
read and execute
list folder contents