ghie
ghie

Reputation: 587

http 500 internal server error how to fix

I am having a problem "500 Internal Server Error" when I used web service call. What is causing this problem? How to resolve it?

Please advise me..

Here's my code:

   MailMessage objEmail = new MailMessage(new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()), new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()));
    objEmail.Subject = "Test";
    objEmail.Body = "EJSCODE:" + _Message;
    objEmail.Priority = MailPriority.High;
    SmtpClient SmtpMail = new SmtpClient();
    SmtpMail.Host = "localhost";
    SmtpMail.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
    SmtpMail.PickupDirectoryLocation = @"C:\Inetpub\wwwroot\MailMsg2"; 
    SmtpMail.Send(objEmail);

Upvotes: 9

Views: 75743

Answers (3)

Adam
Adam

Reputation: 411

I got the error from a duplicate URL Rewrite value in my web.config file.

Upvotes: 1

heximal
heximal

Reputation: 10517

Also you can look at IIS log, that by default stores at C:\Windows\System32\LogFiles\W3SVC1 - there you can find the error description

Upvotes: 4

Paulo Santos
Paulo Santos

Reputation: 11567

The 500 error code is a generic HTTP error state that indicates a faulty state of the web server.

There can be innumerable reasons for receiving such error. Without further analysis there is no way to determine what's causing the error.

Try debugging your code step-by-step and check the exception being generated.

Upvotes: 4

Related Questions