Application hanging in a web service - c#

I have an application that users were complaining that it hangs when the user trys to perform a certain action. I found it that it is hanging in a web service call. The web service is running on a remote server. I can't figure out how to debug into the web service through VS when the code is on a remote server.
How do I find out in the web service where exactly the code is hanging?

If you don't have access to the source of the web service then you're not going to be able to "debug" it. If you want to try to externally debug it then you can create a page that sends various inputs to it (some that should work, some that should error out, etc). You can then access this page in a browser that has developer tools (I would recommend Firefox w/ Firebug or Google Chrome) and then look at how long the calls are taking. Google Chrome will show you how long it took to send the request, how long it waited, how long it took to receive, etc. If it IS the actually web service and you don't have access to it then it would be odd that you were responsible for fixing this issue. I have a feeling though, if this is a robust web service, you're going to find that you're either having a networking issue or your sending it some invalid input or something along those lines.
If you do have access to the source code then simply run the web service locally and point your local version of the application at the local version of the web service. Any breakpoints you put in the web service will hang the application and you will be able to step through it just like you can non-web-service code.

In your own code, take a look at what is going on with the web service call. e.g Does it throw a fault? Timeout? Does it ever return a successful response? If not, are you sending valid data?
If the web service call is successful but just slow, consider how you might make your application appear to be more responsive. One possibility is to use Asynchronous Programming.

Related

Getting a notification when my web service is down

I have created a WCF SOAP web service in C# and a C# application. Other users will work with the application and are trying to get information from a local database via the web service.
Now is it possible that the web service can go down. Then I want as quickly as possible, let's say getting an email.
I can let the application which is by the users sending an email when they don't get a connection with the web service, but there are more than 10.000 users. And I don't want to get 500 emails when there are 500 online.
Is there a better solution for getting an email when my web service is down?
I would suggest a sort of heartbeat program that runs on another server / location.
This will not only test the server, but also your internet connection for example;
Will work even when the power is down.
There are programs to do this already. The only I know is Microsoft System Center and Nagios.
There are a lot of monitoring software packages out there if you want a pre-made tool. The company I work for uses New Relic. (http://newrelic.com/server-monitoring).
If you add a simple function to your webservice, that simply returns true, you can call it periodically (maybe every minute?). If it times out, your service is down, and your monitoring program can email you.

Test a web application which has a callback page

I can usually test my web application on my PC. (In "production" it's on a web hosting server.) But now I have a callback page (.ashx) and am not sure how to proceed - How do I have my application receive the callback? Is there some way to have the callback page redirect to my PC? Some way to have my PC receive callbacks and specify the callback address as my IP (I can chose any callback url I want.)? Maybe some other way?
I don't need to actually attach it to the debugger, only to see the results.
If your ASHX file is in an ASP.NET Web application or website, you can host it locally with IIS or visual studio and then call it with Fiddler (www.fiddler2.net)
Using fiddler you can make calls to your ASHX and pass any payload required.
I don't know your network environment, but depending on how flexible it is, you could set up dyndns or a static domain so that your callbacks actually reach your PC.
I don't love it, but it's a logical solution. Then once you've got everything working properly, you update the domain in all of your call backs to point to production, and you should be ready to go.

Web Service Request issue in C#.net WSDL

We are creating a web service request for IBM Maximo web services in C#.net , the issue is apart from for few web service requests we get succesful response for all other web services, but for some requests there is no response at all, but when we give request for the same using the SOAP UI, we get response.
Where would the problem be ? Any ideas?.
Many thanks ,
byfour
Any ideas?
Start debugging. First of all, of course your application contains logging, so you can see whether any exceptions occur while sending the message.
If no exceptions occor on your end, you can configure tracing to log all actions the WCF plumbing is executing, so you can see whether that part goes well. If it does, you can start debugging the network. If you see your message going over the wire, it's time to pick up the phone and call the other party and ask if they see anything happening after they receive your messages.

How to Debug a web service

We have a Win32 application that connects to a third party application to send some info to it. That application has a web service that we call its methods. One of its web methods is called GetDevices and when our application is calling it, it will fail to work and I have no idea what are the details of this failure. So we should write a small diagnosis application that can create some detailed log files to know what is going, send it to them to run it and then we may know what is going on with more detail. Now do you have any ideas what is a good way to write such a diagnosis application for this debugging purpose?
If this web service is using HTTP (either SOAP or REST) you can use Fiddler to snoop the HTTP traffic and see what's happening.
When web requests are made, the request (and response from the server) will show up in Fiddler, and you can use that to determine why it's not doing what you expect.

How to debug soap web services?

If I have a server sitting somewhere that is not returning the correct information to a client that uses async methods to communicate with it, how do I debug this with soap?
I mean, atleast with rest I can just type in a web address inside a browser and see on the screen the xml response. But how is debugging usually done with soap?
Note, my client is c#/wpf and the server is java
Have look at soapUI. I usually use it to develop and debug soap based web services.
As already mentioned soapUI is great tool if you want to test communication manually. If you want to see what exactly happens between your application and the service use Fiddler.

Categories