Freigeben über


Configuring TCP Activation from the Command Line

Can I configure non-HTTP web service activation from the command line?

Yes, and you don't need any special tools if you're already familiar with configuring IIS from the command line. I've already talked about how to configure a new web site or application for activation in a previous post. Modifying the configuration uses the same appcmd program that is installed as part of the IIS scripting tools. It's installed on my system as %windir%\system32\inetsrv\appcmd.exe.

All modifications to the web site are going to start with appcmd set site sitename and all modifications to the application are going to start with appcmd set app appname. The sitename and appname are the long path name for the web site or application, such as "Default Web Site" or "Default Web Site/myapp".

The list of protocols for activation is associated with the application. Enabling an application to be activated using TCP would look like appcmd set app "Default Web Site/myapp" /enabledProtocols:net.tcp.

The protocol configuration is associated with the web site. Each protocol configuration is called a binding (not related to a WCF binding) and corresponds to a protocol scheme, IP address list, port, and host header. Not all protocol schemes are going to support all of those other things. Adding a new configuration for TCP would look like appcmd set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='808:*']. That same binding would be deleted by changing the plus to a minus, appcmd set site "Default Web Site" --bindings.[protocol='net.tcp',bindingInformation='808:*'].

Changing the IIS configuration requires administrator approval. If you don't have permission to access the configuration file, you'll get an error that looks like this:

 ERROR ( message:Configuration error
Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Line Number: 0
Description: Cannot read configuration file
. )

Next time: Address Filters that Swallow GET

Comments