views:

61

answers:

2

Can we add webservice(.asmx) to window application.When i go through File->New Project-> i cant see webservice template for addind. But in File->New Web Site(for window application) we can easily add webservice

But when you go through this link codeproject.com/KB/webservices/… ,,there they are adding in window application side means File->New Project-> –

A: 

Adding a Web Service in .NET...

You need to understand the wCF vs ASMX first, and for that I will point you to one of my answers regarding the subject.

What is the difference between an asp.net web method and a wcf service?

after knowing that, you will know that ASMX Web Services require IIS to live, and for that, you will only find the template of a ASMX Web Service in a Web site project.

You can off course create a WCF Service, and you can host it anywhere you want, in IIS, as a Windows Service, as a TCP/IP service, as ... everywhere :)

Witch I thing is what you are after.

There are plenty of Video Tutorials outthere regarding WCF Services so you can see how to make and consume one.

balexandre
But when you go through this link http://www.codeproject.com/KB/webservices/myservice.aspx ,,there they are adding in window application side means File->New Project->
peter
thats a "New Project", it will not be in your WinForm project!! and if you follow up, you will see that you need to set up IIS as I mention.
balexandre
+1  A: 

For a webservice to run, you need it to run under IIS, which your windows app isn't.

Do you want another app to be able to call a SOAP interface when your application is running? Then in that case I think you may want your app to start a windows service.

Neil N
But when you go through this link codeproject.com/KB/webservices/… ,,there they are adding in window application side means File->New Project-> –
peter
some thing... you should read the complete URL that you posted before assuming anything!
balexandre