IIS6 Executes Borland CGI, but VS Executable Gives HTTP 500  
Author Message
buzzlight2nd





PostPosted: Visual C++ General, IIS6 Executes Borland CGI, but VS Executable Gives HTTP 500 Top

Please help! Am I missing a directive to get the code to execute in IIS6 IIS6 is installed on 2003ServerR2, Beta. The configuration is OK with the server, because it worked fine with the Borland Executable. However...

C++ Express 2005 Executable causes IIS to give HTTP 500 with the following code, and #include <iostream> is added to stdafx.h as well :

//

#include <stdafx.h>
#include <iostream>
using namespace std;
int main()
{
cout << "Content-Type: text/html\n\n";
cout << "<HTML><HEAD><TITLE>Hello World</TITLE></HEAD><BODY>\n";
cout << "<H3>Hello World</H3>\n";
cout << "</BODY></HTML>\n";
return 0;
}

//

While BORLAND Executable works fine in IIS6 with the following code:

//

#include <stdio.h>
#include <stdlib.h>
#pragma hdrstop
#pragma argsused
int main(int argc, char* argv[])
{
printf("Content-Type: text/html\n\n");
printf("<HTML><HEAD><TITLE>Hello World</TITLE></HEAD><BODY>\n");
printf("<H3>Hello World</H3>\n");
printf("</BODY></HTML>\n");
return 0;
}

//

Thanks In Advance!



Visual C++8  
 
 
Viorel.





PostPosted: Visual C++ General, IIS6 Executes Borland CGI, but VS Executable Gives HTTP 500 Top

I would suggest either trying printf instead of cout, or outputting "HTTP/1.0 200 OK\n" before other lines. Also instead of cout << "...\n" you can try cout << "..." << endl;