views:

30

answers:

1

I'm having trouble figuring out why my web service is not working correctly when called from my asp.net application in production only.

I am able to run my asp.net application locally, calling the web service (in production) and it completes correctly.

I am able to modify the web.config to allow me to use the test form on the production web service and it calls correctly.

I'm calling the web service in a shared dll, and I already check that I am actually getting the updated dll.

This is a very basic web service to log any exceptions on our sites that aren't handled elsewhere. I'm adding additional parameters to it, and also moving it to another project so it is grouped with more of our web services. It is in it's own asmx file called ExceptionServices

My shared dll has a class ErrorHandler which calls (at this point, a test method) TestEmail(string to) and all that does is sends me an email.

Like I said, when running my app locally, it calls the production web service and all is good.

I am running in a hosted environment and am unable to install the remote debugging tools so I cannot step through the production code (unless anybody knows any tricks).

It just seems like this should work (banging head on keyboard)...

Here is my basic web method:

    [WebMethod]
    public void TestEmail(string to)
    {
        MailMessage mm = new MailMessage("[email protected]", to, "test", "body here");
        SmtpClient client = new SmtpClient("localhost"); // already tried tweaking smtp server, and all my options work when I use the test form
        client.Send(mm);
    }

ErrorHandler class in the shared dll

public class ErrorHandler
{
    public static void ThrowError(Exception ex, string sitename, string ip, string username)
    {
        //if (ip != "127.0.0.1") // exclude local errors when developing
        {
            EILib.ExceptionServices.EIExceptionHandler eh = new EILib.ExceptionServices.EIExceptionHandler();
            eh.TestEmail("[email protected]");
        }
    }
}

and finally my global.asax where it all begins:

    protected void Application_Error(object sender, EventArgs e)
    {
        //Get the Error.        
        System.Exception anError = Server.GetLastError();
        EILib.ErrorHandler.ThrowError(anError, "mydomain.com", EILib.Utilities.GetUserHostAddress(Request), User.Identity.Name);
        ....
    }
+1  A: 

Verify that the SMTP service is running on your production server. Check that it is configured to allow the default credentials (a hosting company might well require credentials for email). Check that the service is configured to receive mail from from the local computer (as opposed to using one of the pickup directory delivery methods).

ThatBlairGuy
SMTP is not the problem. I am able to use the test form and successfully send an email. I am also able to successfully call the web service from the app running on localhost. Also, the previous web service I was calling, hosted on the same server was also sending an email.
senloe
It must be a configuration issue. If the web service works independently, then it's something with the code which calls it. Does the executable containing the reference to the web service have the correct URL in its config? (Is it still pointing to the old service?)
ThatBlairGuy
I removed the old service when adding the new one. I did also verify it has the correct URL. I peeked through the files in the Web References folder and where ever I see a URL, it's the correct one.
senloe
What about the web.config on the production server? It's possible to override the URL from there.
ThatBlairGuy