Freigeben über


Configuring Windows Server Core for ASP.NET

I was recently working on Windows ServerCore and had to dig around for setting up the server for running ASP.NET and also do mundane tasks around adding applications to IIS and configuring the app pools.

 Following is a list of commands for anyone working on ServerCore. These commands cover the basic tasks anyone has to deal with while configuring the server for AspNet scenarios.

 

Machine Settings

 

Network configuration

netdom renamecomputer %computername%  /newname:{newComputerName}

netdom join %computername% /d:{domainName}  /ud:{domain\Username} /pd:*

Net localgroup Administrators :{domain\Username} /add

 

Allow Remote Management in the Firewall and enable Remote Administration . . . . . .

netsh advfirewall set allprofiles settings remotemanagement enable 

Restart

Shutdown /r

shutdown /r /t 0  

Eventvwr.

There is non on Windows server core so you use the following tool wevtutil.exe

wevtutil.exe qe System /rd:true /c:3 /f:text

wevtutil.exe qe Application /rd:true /c:3 /f:text 

 

Install IIS and set remote management

https://learn.iis.net/page.aspx/334/install-and-configure-iis-7-on-server-core/

 

Dism /online /enable-feature /featurename: IIS-ManagementService

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WebManagement\Server /v EnableRemoteManagement /t REG_DWORD /d 1

 

Configuring ASP.NET applications and application pools

 

Applications

  1. "appcmd list app" will list the applications
  1. "appcmd add app /site.name:"Default Web Site" /physicalpath:"C:\test\Foo" /path:/Foo"
  2. "appcmd set app "Default Web Site" /?" To list all the properties supported by the website
  1. "appcmd set app "Default Web Site/Foo" /?" To list all the properties supported by the app
  1. "appcmd set app "Default Web Site/Foo" /applicationPool:[AppPoolName]" to set the app pool that you want this app to run on. By default it is defaultapppool

AppPools

  1. "appcmd list apppools" will list the app pools along with Fx version and pipeline modes
  1. "appcmd set apppool "DefaultAppPool" /?" To list all the properties supported
  2. "appcmd set apppool "DefaultAppPool" /enable32BitAppOnWin64:[true|false]"
  1. "appcmd set apppool "DefaultAppPool" /managedPipelineMode:[Integrated|Classic]"
  2. "appcmd set apppool "DefaultAppPool" /managedRuntimeVersion:[v2.0|v4.0]"

 

Accessing ASP.NET features like Session State Service and PerfCounters

AspNet State Service

Query

Sc query type= service state= all

Sc qc aspnet_state

Start

Sc start aspnet_state

Pause

Sc pause aspnet_state

Resume

Sc continue aspnet_state

Stop

Sc stop aspnet_state

 

PerfCounters

Use typeperf.exe(https://technet.microsoft.com/en-us/library/cc753182(WS.10).aspx)

Listallcounters

typeperf.exe -q "ASP.NET v4.0.30319"

Sample output

\ASP.NET v4.0.30319\Application Restarts

\ASP.NET v4.0.30319\Applications Running

\ASP.NET v4.0.30319\Requests Disconnected

 

Verify the perfcounter count

typeperf.exe "\ASP.NET Applications v4.0.30319(*)\Requests Total" -sc 2

 

Resources:

https://technet.microsoft.com/en-us/magazine/2009.02.geekofalltrades.aspx?pr=blog

Primer on server core commands https://technet.microsoft.com/en-us/library/ee441258(WS.10).aspx

https://technet.microsoft.com/en-us/magazine/dd630943.aspx

https://code.msdn.microsoft.com/R2CoreASPNET

https://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/

Enable automatic updates and force an update . . . . . .

Scregedit.wsf /au 4

start /w net stop Wuauserv

net start Wuauserv

wuauclt /detectnow

 

Kill a process

taskkill /PID <process ID>