How to capture chat response with LoadRunner? - asynchronous

I'm looking to load test a message server with Loadrunner. On one end of the message server it's a web application, and on the other end it's a desktop client.
web application <--> message server <--> desktop application
I have recorded a script from the web application, and the script is currently sending messages to the desktop client fine.
script >--send message--> message server >--> desktop application = OK
I'm looking to capture messages sent from the desktop client in the script, but I'm having trouble trying to capture a response from the server. Any ideas?
The web application is polling every second for messages from the desktop application.
I'm pretty new to this, so I apologize if this is a little vague. Please feel free to ask any questions, and I'll do my best to clarify.

When you record a script in VuGen (let's say, using Web HTTP protocol), the "Start recording" dialog gives you options to record either a browser or an application. In the latter case you're prompted to select application's .exe file, and then it should be recorded. Have you tried this?

Related

XML web Service

iam using adobe flex and connects it to XML web Service(asp.net)
now the situation is like this
Sometimes i send large data on to the web service ,the data reaches correctly to the web service and the web service starts to save it in an SQL server database ,in some cases the connection with the web service is lost -but that does not mean that the web service stops processing the data couse the data is already there
my problem is that the web service continues to work and flex is giving me everything is ok , so when i send another time a duplication happens
so is there a way on FLEX or asp.net to check is the connection (not internet connection ) is still valid and if its lost during the processing to cancel it
Thanks a lot
Depending on your server process, you can add a remote validation method to see if it started working and how far through it has gone.
For example, if you requested 80 calculations and it timed out, you can call a different server-side method from Flex to check in the database for registers of calculations completed. If only 46 of them have been done, you can display a completion rate in your client of 46/80 = 57.5%

background thread in asp.net application

i run a background thread in Application_Start() in global.asax
to use it like windows service
but applicaton_end fire when all session is ended in my website
i have a sms Business that work with webservice and i want to have agent in my server that
check incoming message like windows service
i increase session timeout to 10 hours but when i close browser application end fired and
my thread stop working
i cant change server properties
can i disable application_end to thread keep working?
I apologize to you because of poor english writing
You should make a separate program that runs as a service or a batch program to do that. Although ASP.NET persists static variables and such between page loads, you shouldn't be using it to run things in the background. There is no guarantee that things will keep running.
If you need something to happen on the user's end when something happens on the server (like a message received (like on facebook), someone responds to a request, or some other event is raised) you need to implement a polling system in javascript on the webpage that the user sees which uses AJAX (look it up...its such an awesome concept) to periodically talk to the server to see if anything happened. That is how Facebook chat works along with most webmail systems to check for new messages. The server doesn't talk to the browser...the browser asks the server if anything happened.
Here is an example of a chat program that uses AJAX: http://www.dynamicajax.com/fr/JSON_AJAX_Web_Chat-.html
It isn't exactly what you are doing, but it demonstrates the concept of trying to check something after the page has been loaded and making the user's browser respond.
Nay be use a .NET version of quartz-scheduler library (http://quartz-scheduler.org/) for defining and triggering a job based on the configuration (cron expresion).
iis automatically close website application when no session is open in website
for disable this you can change idle time in iis or read website link in global.asax (application_end) function to start a new session

ASP.Net connection keep alive for long running server-side task

I have an ASP.Net C# web application, running on IIS, that I'm supporting which involves generation of word documents. Some of these word documents take a very long time (i.e. upwards of 20-30 minutes) to generate. What I notice while testing on my dev server is that the server closes the connection long before the process completes, the server-side ASP.Net code itself enters a loop and updates the status of a boolean value when the word doc generation completes.
My workaround for this is to keep the connection alive by implementing a dynamically animated wait screen ( using jquery and ajax) on the client-side that's updated by a repeated asynchronous AJAX call to the server that checks on the status of the operation from a server-side web method. I'm asking about that piece in another question.
Is the solution I'm looking at implementing the best approach to this problem? Are there more efficient or common methods for keeping the connection alive during a long running server-side operation? Any help or insight is appreciated, thanks.
UPDATE:
I tried Brian's suggestion, unfortunately I still get the same error from Chrome that no data is being sent from the server and the entirety of the error is as follows:
No data received Unable to load the webpage because the server sent no
data.
Here are some suggestions: Reload this webpage later.
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection
without sending any data.
I'll try again by setting the connection timeout in the advanced website settings as described and increasing the connection idle setting.
Ideally, you'd use a socket to notify the client when the process completes. Look at socket.io or native web-socket implementations on how to do this.
You can control Idle time within IIS 7. This is done by going to IIS management; select application pools; then right click on the pool your using for your website. Click the "Advance settings" here you will be able to control idle time out and some other settings for your website. Hope this is what your looking for.

Classic ASP Website timed out sending mail (IIS6, default SMTP server)

I have just moved a customer's Classic ASP website to their own VPS server (Windows 2003, 32-bit, IIS6, Virtual SMTP server) and after about 12 hours the website starting failing whenever it tried to send emails (CDO.Message).
Any script that sent an email took a very long time before it returned the error: Active Server Pages, ASP 0113, Script timed out. The standard timeout is in place. Strangely the custom error page which sends errors to me using the same email send method and settings (same function actually) was able to send me the error notification.
I needed to get the website going so I stopped/started the SMTP server which didn't help, then restarted IIS which resolved the issue immediately.
I am worried this might happen again. Any suggestions for what can cause this problem or does the default SMTP server need some additional settings to cope with a reasonably high-volume website?
Since classic ASP code has to call an external COM based component in order to send email (that's what you are doing if you are creating a CDO message --- anytime you have a CreateObject call in your asp code, that is COM), the asp code will appear to hang if the external component takes a long time to respond. For example, most SMTP components will synchronously try to send the message to the SMTP server blocking your asp code from executing until the email message is sent. This becomes a problem on very busy SMTP servers, as they can be very slow to respond to connection requests and to SMTP commands. Another bad situation is that many ISP's/hosts attempt to throttle the speed you can send email by purposefully making their SMTP servers respond slowly. Even worse, some hosts will go so far as to actually make subsequent connections over a set time period progressively slower. This can significantly impact your site performance since you are typically having your page code blocked during the SMTP send.
The best solution would be to use a host or SMTP server that does not enforce such restrictive measures. Barring that, there is a way to work around this by using message queuing. If you are using CDO, this means you have to configure the Microsoft SMTP Service on your IIS web server for use. This can be configured properly even if you do have other SMTP software on the IIS machine. Once the Microsoft SMTP Service is running on your IIS server, it will be able to queue email on the server and forward them to the configured SMTP server asynchronously to your application / page code. When configuring the Microsoft SMTP Service, you must define what it calls a "smart host". This is simply the SMTP server you are going to route the outbound email to for delivery on your network.
Once you have that configured, you just have to change your code that uses CDO to queue the email message instead of trying to send it. In your CDO code, you should have a line that sets CDO field values which look something like this:
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
You want to change the value for the "sendusing" field from a value of 2 to a value of 1. These are the enumerated values for the cdoSendUsingPort (2) and cdoSendUsingPickup (1) enums. Once you do this, you can also drop the "smtpserver" and "smtpserverport" fields as these are overridden by however your Microsoft SMTP Service is configured. Once you do this, your asp code will quickly generate the email message and it will be queued in the IIS server's mail pickup folder. So your application / page code will run much faster. The outgoing emails will potentially accumulate in the queue folder as the SMTP Service slowly works on delivering them in the background. It doesn't make the email get send any faster, but it does prevent your code from blocking due to a slow SMTP server.
I later found that the actual sending of the email was not causing the problem but the fact that I was generating the HTML body for the email by retrieving HTML from another ASP page (via the XML object).
I tried various things to fix the problem including switching mail components (to Jmail) and using different versions of the XML object but the problem would still occur intermittently.
In the end I changed the code to generate the HTML for the email body instead of calling another ASP page and reading it's response.
Eliminating use of the XML object seems to have resolved the problem but the cause was never found.

Scheduled Mail in asp.net

Hai Guys,
My application deals scheduled mail concept (i.e) every morning 6.00 am my users gets a remainder mail about their activities for the day... I dont know how to do this.... Many told use windows service but i will host my website on a shared server i may not get rights to do windows service... Is there any dll for sending mails at a schduled time through asp.net application ..please help me out guys......
You cant do much in a shared hosting. Try upgrading your hosting or else write a windows service, to run on your machine, which will call an asp.net which can send out emails. Of course your machine has to be switched on all the time or at least during 6:00 AM :). You will have to take proper steps to avoid unauthorized request for that aspx page.
you can check this article too: http://www.codeproject.com/KB/aspnet/ASPNETService.aspx
You can't really do this with ASP.Net. ASP.Net is for web pages - which are reactive to HTTP requests.
You need a scheduled task or a service. All a website can do is respond to requests. I guess you could program the functionality into a web page and have a remote process request the page every morning - but what happens if someone else requests the page?
You can either have a program that runs constantly and has a timer or a loop that checks the time of day and then sleeps for a really long time and when the timer goes off or it's the right time of day it sends an email, or you can launch a program as a scheduled task. The first method can also be implemented as a service if you would like. Keep in mind you dont need ASP.Net to send emails, all you need is a console application that uses System.Net.Mail. Check out the mailer sample on MSDN for a very simple idea.
One other thing you can consider: IIS has an smtp service that you can install and it uses a pickup directory to send mail. You write an email to the pickup directory as an .eml file and IIS grabs it and sends it almost immediately. If you do that, you'll still have to write the emails (System.net.Mail will write the .eml files from a MailMessage, just set SmtpClient.DeliveryMethod to SpecifiedPickupDirectory or PickupDirectoryFromIIS and call SmtpClient.Send) but it will then send them for you. You'll still need to schedule something somehow so this might not be all that more useful but I thought I'd at least let you know that it exists.
One thing to be aware of: when the IIS SMTP service reads the send envelope of the .eml file, the order of the Sender and From headers is significant; if the From header appears before the Sender header then the MAIL FROM command will use the From header, which is incorrect (and MS won't be fixing this one). This appears to be an issue ONLY with the IIS SMTP service as it hasn't been reported anywhere else that I'm aware of. Reversing the order of the headers is the work-around. By default SmtpClient always writes the From header first. I'm aware of the issue and IIS isn't fixing it but I may be able to get a fix into SmtpClient for the .NET 4.0 RC build that re-orders the headers for you but no promises.
If you happen to have it handy (and I assume you do), you can use a SQL Server Agent job to make a request to an ASP.NET page that sends the email.
Here's some example code:
http://nicholasclarke.co.uk/blog/2008/01/16/web-request-from-sql-server-via-c/
Of course, since you're using SQL Server to call CLR code anyway, you could just have that code send out the emails (via System.Net.Mail) rather than requesting a page on IIS to do so. To do this, SQL Server would need:
Access to all of the data needed to send the emails
Outbound firewall access to send an email
CLR code that encapsulates all of the logic needed to know where/what to send.
Okay this is interesting, and what I did fits silky's definite of 'cheating', but no it was pretty cool for me.
What I did was spawn a new thread from ASP.Net code (it was possible on that host), and that thread did the scheduled job.
I checked whether the thread was alive (which is pretty easy) on every visit to the website (not so reliable I know, but it worked cause that website has plenty of visitor).
If at all you do this
Treat this as a stop-gap while you arrange to get a dedicated host or VPS.
Rest assured that the hosting company will kill your thread and withdraw permissions when they discover you're doing this.

Resources