You can debug a CGI applications using the Just-In-Time Debugger with an embedded call to CBL_DEBUGBREAK, or using the 
                     			 Wait for debuggable attachment or 
                        				Launch URL debug options in the project properties. If the Web server is configured to run as a service you need Administrator privileges to allow the debugger to attach to
                        the CGI process. 
                  		
               
 
               		
               Tip: If the Debugger fails to find the symbols for your program, you can add the path to the CGI symbols to your symbol path. 
                  		  Do this from the 
                     			 Debugging > Symbols page in your Visual Studio Options. For example: 
                     			 c:\apache2.2\cgi-bin. 
                     		   
                  		
               
 
               		
               You can debug native CGI projects using the Launch URL start option. 
                  		
               
               	 
              
            
            	 
            
               Debug using Wait for debuggable attachment
 
               		 
               		
                
                  		  
                  - Start your Web server. 
                     		  
                  
- Ensure the CGI binaries are in a folder on the Web server and execution of CGIs in that folder is enabled. 
                     		  
                  
- Start the IDE. 
                     			 
                     Note:  
                        				
                         
                           				  
                           - If the CGI is running as a service, you must start Visual Studio with administrator's privileges. 
                              				  
                           
- You can use the httpd executable to run the Apache Web Server from the command line. Since this executable uses your own User
                              ID, it is not necessary to start the IDE with administrator's privileges. 
                              				  
                           
 
 
- In the IDE, click 
                     			 Project > 
                        				myproject properties and select the 
                     			 Debug tab. 
                     		  
                  
- Choose either one of the following debug options: 
                     			 
                      
                        				
                        - Set 
                           				  Launch to 
                           				  Launch Browser and specify the application URL in the 
                           				  Launch Browser field - for example, 
                           				  http://localhost:80/cgiform1.htm. 
                           				  
                           To ensure that this option will wait for the correct CGI, either the project output folder or the path specified by the 
                              					 Working Directory setting on 
                              					 Debug tab must match the CGI folder of the Web server. 
                              				  
                            
 Or, 
                        			 
                       
                        				
                        - Set 
                           				  Launch to 
                           				  Wait for debuggable attachment and specify 
                           				  Wait for directory. 
                           				
                        
- Specify the path to the CGI folder in the 
                           				  Working Directory field. 
                           				
                        
 Also: 
                        			 
                       
                        				
                        - Check 
                           				  Return to waiting state when debugging, if you want to debug the CGI application multiple times. 
                           				
                        
 
- Click 
                     			 Debug > Start debugging. 
                     			 
                     The debugger waits for your CGI application to run, and then attaches to it. 
                        			 
                      
  
            	 
            
               Debugging using a URL
 
               		 
               		
                
                  		  
                  - Start Visual Studio as Administrator. 
                     			 
                      This is because the application runs under the IUSR account and therefore the debugger needs appropriate permissions to attach
                        to the process. 
                        			 
                      
- Load your solution and build it. 
                     			 
                     create the site directory structure. 
                        			 
                      
- Ensure that your Web server is configured to run your application. 
                     			 
                     For IIS, see the instructions in 
                        				Enabling CGI Support. 
                        			 
                      
- On the 
                     			 Debug tab in the project's properties, set 
                     			 Launch to 
                     			 Launch Browser. 
                     		  
                  
- Set the URL to 
                     			 http://localhost:port/myappform.htm. 
                     		  
                  
- Start debugging. 
                     			 
                     Complete and submit the form in the browser instance that starts. The debugger will stop when your application is executed.
                        
                        			 
                      
  
            	 
            
               Debug using CBL_DEBUGBREAK and the Just-In-Time debugger
 
               		 
               		
               You can also embed a call to CBL_DEBUGBREAK in your code and use it to debug CGIs. When the CGI runs and the call is encountered,
                  you receive a Just-in-time debug notification which prompts you to allow the CGI to be debugged with administrator's privileges.
                  
                  		
               
 
               		
               Alternatively, you can start the IDE as described above and configure it so it automatically starts debugging the CGI, when
                  the call is encountered. You need to specify the following option on the 
                  		  Debug tab in the project's properties - set 
                  		  Launch to 
                  		  Wait for debuggable attachment and specify 
                  		  Wait for any program. 
                  		
               
 
               		
               Note: You must use any of the 
                  		  Wait for debuggable attachment options when you debug CGIs that run under IIS 7.5. By default, this application uses "ApplicationPoolIdentity" to run CGIs
                  which blocks the Just-in-time debug prompt.