HTTP Error 502.2 - Bad Gateway

We have recently migrated from Old webservers (Win2003 - IIS 6) to New Servers (Win2008 R2 - IIS 7). Now we are getting error when accessing the URL getting error

HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Module      CgiModule
Notification      ExecuteRequestHandler
Handler      CGI Script Map
Error Code      0x000000ff

I recently noticed older Web Server has Perl v5.8.8 and New server has Perl v5.20.1. Need help on this.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shalom CarmelCTOCommented:

The error speaks for itself.
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
A Perl program is mibehaving.
Does anything else written in Perl work? Did you try a Hello World perl program?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Meaning of error message:

502 Bad Gateway
    The server was acting as a gateway or proxy and received an invalid response from the upstream server.

Lets first check that the script itself is working correctly.  Try running the script from the command line instead of through the browser and  post the exact output it generates.

It would also be helpful if you post the script so we can see what it's doing.
crazymasterAuthor Commented:
Thanks guys for your reply, HTTP headers was not correct. I have changed it and its working.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.