Does Modifying Web.Config Require IIS Restart for WCF Service Changes in .NET 3.5?


2 views

When working with WCF services on IIS 6.0 (Windows Server 2003), understanding configuration changes is crucial. The Web.config file acts as the central configuration hub for ASP.NET applications, including WCF services built on .NET Framework 3.5.

Not all Web.config modifications require an IIS reset. The behavior depends on which section you modify:



<system.serviceModel>
    <diagnostics>
        <messageLogging 
            logEntireMessage="true"
            logMalformedMessages="true"
            logMessagesAtServiceLevel="true"
            logMessagesAtTransportLevel="true"/>
    </diagnostics>
</system.serviceModel>

For WCF-specific configuration changes under , IIS doesn't automatically detect modifications. You'll need to:

  1. Recycle the application pool
  2. Or perform an IIS reset (iisreset /noforce)

Instead of full IIS reset, consider these less disruptive options:


:: Command line approach for app pool recycling
appcmd recycle apppool /apppool.name:"YourAppPoolName"

For diagnostic configuration changes:

  1. Make changes during low-traffic periods
  2. Test changes in staging first
  3. Document all configuration modifications
  4. Consider using configSource attribute for externalizing sections

<system.serviceModel configSource="wcf.config"/>

When working with WCF services in .NET Framework 3.5 on Windows Server 2003, understanding configuration file changes is crucial. The Web.config file serves as the central configuration point for ASP.NET and WCF applications. For most standard configuration sections, IIS (Internet Information Services) automatically detects changes and applies them without requiring a restart.

However, there are specific scenarios where an IIS reset is required:




    
        
            
                
            
        
    

Structural changes to the section often necessitate an application pool recycle. For diagnostics additions like these:



    
        
            
                
            
        
    
    
        
    

These diagnostic settings usually don't require IIS restart, but the WCF service host might need to be recycled to pick up the new tracing configuration.

For environments where uptime is critical:

  • Test configuration changes in a staging environment first
  • Use app_offline.htm during updates if possible
  • Consider implementing configuration changes during low-traffic periods
  • Monitor application logs after changes

To check if your changes took effect without restarting IIS:


// C# code to verify WCF configuration
ServiceHost host = new ServiceHost(typeof(MyService));
Console.WriteLine("Endpoint count: " + host.Description.Endpoints.Count);
// Additional verification logic

While frequent application pool recycling solves configuration update issues, it impacts performance through:

  • Cold start penalty
  • Session state loss
  • Increased memory fragmentation

For low-usage scenarios like yours, the performance impact of restarting IIS is minimal compared to the benefits of proper configuration testing.