I want to create a webservice in the c#.net.
开发者_开发百科How do I create a Web Service that I could use with a winforms app to communicate over a network.
Could someone help me.
Thanks
Update: I missed your bit about windows forms. When you say web service you mean some something that exposes data over an intranet or the internet. I'm sure that is what you meant. Communicating between two applications (like a chat application) could use a webservice to communicate OR could communicate directly to each other over the network. I think I'm sure this is NOT what you meant.
You have some reading to do. Read this for some of the jargon on web services.
You have mainly two options with web services:
XML Web Services (.asmx) : This is basically outdated. But its a little simpler IMO so just try it out. Here is a basic sample on MSDN.
Windows Communication Foundation(WCF) : This (again IMO) is a slightly more complex option. Its an entire framework for building Service Oriented Applications. See this blog article series on getting started with WCF.
Another thing you should learn about once you're done with WCF is Rest.
See How I explained REST to my wife.
You can use WCF to build RESTful web services, which is what things are moving to today.
And one of the best addon features of WCF is WCF Data Services. Which allows you to expose your database (With Entity Framework) over a web service, and your clients can run Linq queries on this service.
You do have a lot of reading to do. Start off by getting a good C# 4 book or a beginners WCF book. (Search Stackoverflow for book recommendations, There are tons.)
Once you hit a specific problem then you can come here, search for an answer. If it doesn't exist, post it as a question.
Good Luck.
精彩评论