One of the biggest benefits of using IIS over a Windows Service is security. It is trivial to configure the remote object to use Windows Authentication to validate an incoming call. Drawbacks include limited configuration options and communication that is restricted to the HttpChannel (which means slower performance). However, you can configure the channel to use binary formatting (versus SOAP), which is somewhat better, performance-wise. The only other requirement is that the hosted object be derived from MarshalByRefObject.
IIS should already be configured at this point. All the necessary assemblies should be in place. If not, review Section 6.1 earlier in the chapter and configure accordingly. Only one addition should be made; a configuration file containing the appropriate entries must be placed in the ServerInfo virtual directory.
The good news is that the configuration file from Example 9-10 can be used as a starting point; just copy it and rename the copy to Web.config. Before placing it in the ServerInfo virtual directory, make these two important changes:
Remove the name attribute from the <application> element. The application name is determined by the name of the virtual directory defined in IIS, not the configuration file. An exception will be thrown otherwise.
Make sure the objectUri is unique. If the Windows Service is still used concurrently with this example, change the objectUri value to something that denotes ...