0

I am calling a webservice to which I have created its end point in my app.config file. I have the following set in my app.config to inlcude the error stack it mentioned.

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="debug">
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ISmsService">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://api.collstream.co.uk/SmsService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISmsService" contract="smsService.ISmsService" name="BasicHttpBinding_ISmsService" />
    </client>
  </system.serviceModel>

Here is how I am calling the method as well

public void send(string from, string to, string message, string section, string userName, string password)
{
        // "Services." will be whatever namespace you specified on the
        // "Add Service Reference" dialog
        var svc = new smsService.SmsServiceClient();

        // This values will probably be coming from a config file in a real application

        try
        {
            svc.SendMessage(from, to, message, userName, password);
        }
        catch (Exception ex)
        {
        }
        finally
        {
            svc.Close();
        }
  }

This is the way that I am trying to process the webservice but i am being produced with the error below any ideas.

{"The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs."}

As you can see in my app.config above I have indead set this here

IncludeExceptionDetailInFaults="true" but still i not getting the full stack trace of the error. This is a class project I am calling the service refrence from.

csharpdude77
  • 3,221
  • 3
  • 32
  • 80
  • The server crashed. Check the server's logs. You can't fix this from the client's side – Panagiotis Kanavos Jul 04 '16 at 11:50
  • Im using iis express on the development side i dont own the server – csharpdude77 Jul 04 '16 at 11:51
  • 2
    PS this ` catch (Exception ex){ }` is actually a capital offence in programming. Instead of throwing away errors, at least log them and *fix* them. Don't ignore them. – Panagiotis Kanavos Jul 04 '16 at 11:51
  • 1
    The server version has nothing to do with the error. Your web service crashed. Check its logs. If you wrote it, debug it. If you use the same `catch{}` code there, remove it and add proper logging – Panagiotis Kanavos Jul 04 '16 at 11:51
  • can you debug the webservice? – Lorenzo Jul 04 '16 at 12:07
  • @Lorenzo no as it is third party I contacted there support – csharpdude77 Jul 04 '16 at 12:29
  • @PanagiotisKanavos thanks I called there support so I did may I ask what is the practise then with try catch I have seen that used in many examples even here http://stackoverflow.com/questions/14973642/how-using-try-catch-for-exception-handling-is-best-practice – csharpdude77 Jul 04 '16 at 13:33
  • @rogue39nin there isn't an empty `catch` clause in any of the "good" examples. It should removed completely. – phuzi Jul 26 '18 at 13:43

0 Answers0