Send data from web form to winforms - c#

Hello i have to develop an application in which im able to send some data(notification) from my webform to windows form and similarly from winform to webform.
Someone told me that i have to use web service for this purpose. so if someone please tell me how can i do that?
Im using C# for this purpose.

The general pattern from Web forms -> Win forms:
Add a WCF service to your Win forms application.
Implement the interface.
Use a ServiceHost and start the service somewhere in your initialization code.
Start your Win Forms project.
In your web forms project, Select References -> Add Service Reference.
Enter the URL in the Forms application's config file. (this is added when you create the service) the service should be discovered and proxy code generated automatically.
rebuild the Web forms project, you should have access to the Win forms service methods.
Services in the other direction are similar, but you don't need a ServiceHost implementation (IIS will host the service automatically)
You'll probably want further configuration as well. Possibly different bindings, and security.

Related

Is it possible to call windows service or process from Web Application?

I want to call my custom windows service running on particular client machine from my Web application on button click. How can I do this?
I got the solution and it works. Please find below steps.
Created Self-Hosted WCF service that call window services/processes
Call this WCF service from your web application
Please find below link for more details:
https://techinqueincsharp.blogspot.com/2019/05/open-clients-machine-local-file-from.html

RESTful web service and calling method under same application

How to create a restful service and a web form application under the same solution? I want to use the same port number for both of them, something like a sub folder for one application. I have created restful using visual studio 2012 wcf and also I've created another project for calling the web service. But I feel that there are two separate application and difficult to maintain.
You can use ASP.NET Web API: http://www.asp.net/web-api. But there will be still small difficulty with combining web forms and MVC.

Use a Web Service in C# Windows App

I am new to using web services. I am assigned a task in which I need to use a web service in my Windows app. This is the web service I would be using:
https://api.betfair.com/global/v3/BFGlobalService.wsdl
Now, I've learned how to add a web reference to this service, but I could not find a basic tutorial that could help me learn how to make an object of this web service and use the service as I want to.
Basicaly, what I need is to create an object from the above web service in my form, and to call it's methods. A C# code snippet would be great.
Can anyone give me some directions? I am working in Visual Studio 2008 and a C# Windows App.
Right click on References
select Add Service Reference
give the wsdl address in the address textbox
click Discover
Give a name for the namespace eg;- BFG
You can access the resources like BFG.MethodName() from you code

Windows service implementation in MVC3

I am working on a MVC3 application. I want to call a function when the date is expired. I would like to use the windows service for this. Can anyone tell me steps to implement the window service in a MVC3 application? I am also open to any other options to call a function at a certain date.
Not possible. the application pool dies after a while. Create one MVC3 application and one Windows service.
you can use console application and set it with window Service or create Scheduler (crone) by task manager might be it will helpyou
and its going to more easy to us if you more describe what exact-ally you are looking for
you can implement the WCF services as a Windows service and create a call back in your Mvc3 application layer
take a look at this link for Creating Duplex Services
http://msdn.microsoft.com/en-us/library/ms731064.aspx

How to send data from a Windows Form Application to a Asp.Net Web Service Application

I have a Windows Form Application connected to a database. It does some simple select operations and shows the result on the DataGridView.
I want to send that data on the grid to a web service. I did some research on the Internet about web services and found that I can easily creat a web service, define its methods and use these methods from my Windows Form Application by using Visual Studio 2010. Unfortunately, that is not what I want. I already have a Windows Form Application with some methods in it. All I want is to send the data (xml) to a web service that I created in Visual Studio. How can I do that?
Thanks in advance.
See "How to Consume a Web Service".

Categories