0

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.

6
  • You mean web form as ASP.NET web application? Commented Dec 16, 2012 at 13:51
  • Yes an asp.net application Commented Dec 16, 2012 at 13:53
  • You mean that one user sends the data through WebForm (for example chat message) and second (WinForm user) gets this message and responses? Commented Dec 16, 2012 at 13:57
  • absolutely all i need is the communication between them Commented Dec 16, 2012 at 13:59
  • Similarly i need to send text files as well but only from winform application to webform? Commented Dec 16, 2012 at 14:05

1 Answer 1

2

The general pattern from Web forms -> Win forms:

  1. Add a WCF service to your Win forms application.
  2. Implement the interface.
  3. Use a ServiceHost and start the service somewhere in your initialization code.
  4. Start your Win Forms project.
  5. In your web forms project, Select References -> Add Service Reference.
  6. 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.
  7. 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.

Sign up to request clarification or add additional context in comments.

4 Comments

I have never worked with WCF can you refer me some tutorial so i could follow the steps?
@user1467270 here's a good overall tutorial: msdn.microsoft.com/en-us/library/bb332338.aspx
And i actually i need something like chat messenger in which i am able send/receive messages from web to winform and vice versa . Similarly i need to send text files as well but only from winform application to webform?
@user1467270 If both sides have the same service implementation (as a chat client would, I suspect) then you can create the WCF service code in a separate project/assembly, and reference that in both Forms/Web to reduce code duplication. You'll still need separate configurations in each project

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.