Capture the network traffic of the windows application - c#

I am working in windows application which consumes WCF services(http) which are hosted in another server.Initial load of this application is too high.
To find out root cause of the issue, I would like to see the network traffic when the windows application is running in my machine and i want to know how much time it is taking to make calls and get data from service.
Is there any tool to capture the network traffic when the windows application is running on the desktop.
thanks

For WCF, you will want to use use WCF tracing. Here is an SO article that talks about how to enable it: How to turn on WCF tracing?

Related

Remote Communication Service for WinForms

Im looking at creating a service on a remote server that a win forms app can communicate with. (Where the forms app is running locally on user machines).
The service can either run in IIS (7.5) or as a windows service, but essentially I need to be able to call the service from the forms app and then have a stream of progress sent back to the forms app from the service, much like you would output to a Console window.
I've looked into using WCF which seems ideal except I couldn't find out whether I can relay progress updates back to the forms app. Also SignalR running as a self hosted windows service seems to be an option but might be overkill?
We'll be running the forms app on win7 and the remote server will be running server 2008.
Are you able to advise best routes to go down for this and if possible some examples or tutorial links?
Many thanks :-)
If you are looking for the application to relay back to the server for progress, seems you are looking for something like this:
WCF Duplex
It basicly enable you to call bi-directional function using open socket.
Hope it helps.
Thanks,
Amir

serial/parallel communication with weighing scale from within browser

I'm currently working on an ASP.Net MVC4 application to automate a production workflow.
my client would prefer the solution to be "zero footprint", so completely running in browser.
One of the issues I can't imagine how to handle is to get data from a weighing scale connected to the client's serial/parallel port from within the page.
(Obviously this can't be done from the web backend ... )
I've been digging around, assuming this could be possible through javascript/jquery, but since this is running sandboxed within the browser, I'm assuming to get stuck that way ...
One of the approaches I considered was writing a self-hosted WCF webservice to run on the client that has the scale attached (hosted by a windows service or console app or so) that exposes the scale readout. Theoretically, that would allow me to consume the webservice in the IIS backend in my MVC C# code and serve it back to the client.
The only issue with this approach is that this would require the application to be hosted locally, where we'd prefer to have it hosted by an external provider.
Is there no way to handle this on the client side exclusively?
I can't imagine I'm the first person running into this, but I can't seem to find what I'm looking for by digging around on the web ...
Any thoughts ?
Thanks in advance! Stijn, Belgium
You absolutely must have a process running on the system that has access to hardware to support reading from any hardware interface. You have a lot of options there- it could be a local service running that can read the serial port and expose a simple HTTP endpoint to the browser. You can also do ActiveX-style controls for IE or browser extensions for Chrome:
http://developer.chrome.com/apps/app_usb.html
Just as a follow-up:
I ended up creating a user-control that reads out the COM-port through PInvoke of CreateFile to open the COM-port ...
Works great, no hassle with an external process running on the client etc ...
Does require full trust in the browser, but that's acceptable, since it'll run on clients under our control ...
grtz,
Stijn

Windows Service on Shared Windows Hosting

I have process which continuously downloads XML from the feed and saves it to DB.
I have a Windows Shared Hosting.
My question is what should I use..WCF or Windows Service or Web Service.
I cant use ASP.net because it will run on call only...but I need it run 24/7.
Can you guyz suggest me how to design it?
I have written a Windows Service but was unable to run it on the Server.
My hosting provider is Hostgator.com
You need to do it in a Windows Service.
To run it you'll need a VPS hosting (or dedicated, but it will cost much more).
Start with building a Console Application that does what you need. After you have it look online how to convert it to a windows service.

Application Server equivalent on Windows

I have a question regarding how to write a windows server side application.
We have now have a system whose client is .NET 4.0 based and a server side application running on jboss on Linux. The server application talks to an Oracle DB.
I am now thinking to move the server side to Windows and DB to SQL server. The server application should be written in C# on .NET as well. However, there seems no Application Server equivalent on Windows. How is a server application normally written and deployed on Windows?
Many thanks
There are a few options, but the very basics would be
Host WCF web services in IIS and take advantage of the management IIS offers, you can bring AppFabric into the picture for more robust and manageable hosting.
Self host your service in a Windows Service.
If it suites your application I would say the AppFabric solution is worth looking at. But this is not a 1-to-1 with with a Java Application Server.
Update
Self hosting WCF is as simple as the follow
host = new ServiceHost(typeof(YourWcfService));
host.Open();
This assumes that you have defined a service called YourWcfService'. The above code in theOnStart` of a Windows Service will start accepting requests to your service. Of course this still requires all the basic configuration in the app.config file.
AppFabric, however gives you a nice environment to manage and monitor your services, so not to sound like a broken record, but I would look into it to see if it is possibly a good fit for you.
Update 2:
I did a quick bing and found this MSDN post, it is oldish but looks like a good example.
http://msdn.microsoft.com/en-us/library/bb332338.aspx
It's not exactly true, there are couple of almost unknow but powerful tools that you can use free:
NetFluid: http://www.netfluid.org/
Service Stack: http://www.servicestack.net

When do we use windows service?

Are there situations that we should use a windows service ?
I am building a client-server project (c#) and the server supposed to work alone without any user so someone advised me to use a windows service to run the server, is this right ? or there are a better solutions ?
Windows services are normally used when an application needs to continuously run. For example if they need to:
Wait for incoming requests. (Like through remoting or wcf)
Monitor a queue, file system etc.
If a program just needs to run periodically, like once a day. It is normally easier to create a scheduled task.
In your situation I would use a service for the following reasons:
You don't need to have a session running. This is good for security, and also reduces overhead on the server.
You get some of the managment commands built in for free
Start
Stop
Pause
Continue
You can handle server events such as shutdown.
Windows service can start running as soon as the machine is powered up, which makes ideal for running as a server, http server for example. No one is required to login.
You should create a Windows Service to run code in the background, without user interaction.
For example, a Windows Service will run even if no-one is logged on.
Any server that accepts connections (such as a mail, web, or FTP server) should usually be a Windows Service.
Well, a Windows Service provides a full framework for your application to work and to remain active while you want it to, so I think its ok.
Windows services are the right thing to use for something that should run all of the time, whether or not a user is logged in.
If you need something to run without an active user logged in, you need to use a windows service.
When you need the application to start running even when no one has physically logged into the machine, which is common with server machines, a service is a good candidate in this case. Especially because the service can be configured to auto start, which means the service will start when the machine is rebooted withut human intervention.
If however you are wanting to host web services (WCF) while a service is an option, you might consider hosting in IIS, this relieves you of writing the actual hosting code etc.

Categories

Resources