41

Hy,

how can I create a asmx web service in Visual Studio 2013?

I have found this short tutorial about that, but when I follow this in Visual Studio 2013 I get an error that says "the type 'Service1' could not be created".

Thanks for help :)

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
Robert Jaskowski
  • 823
  • 4
  • 11
  • 21

4 Answers4

103
  1. Create Empty ASP.NET Project enter image description here
  2. Add Web Service(asmx) to your project
    enter image description here
Damith
  • 62,401
  • 13
  • 102
  • 153
  • looks very simple ^^ but I didn't have this template(?) I'm using VS2013 Professional – Robert Jaskowski Nov 29 '13 at 08:38
  • 18
    funny bug from VS2013 - when you choose .net framework 4.5.1 as your platform, so you don't have the "Web Service (ASMX)" template -> you have to choose .net framework 4.5 (details [here](http://connect.microsoft.com/VisualStudio/feedback/details/806903/the-web-service-asmx-item-template-is-not-available-when-the-target-framework-is-4-5-1-shows-up-for-4-0-and-4-5)) – Robert Jaskowski Nov 29 '13 at 08:58
  • 5
    wondering if it's a bug, or really a 'feature', as per my answer ;) – Noctis Nov 29 '13 at 09:23
24

Short answer: Don't do it.

Longer answer: Use WCF. It's here to replace Asmx.

see this answer for example, or the first comment on this one.

John Saunders: ASMX is a legacy technology, and should not be used for new development. WCF or ASP.NET Web API should be used for all new development of web service clients and servers. One hint: Microsoft has retired the ASMX Forum on MSDN.


As for comment ... well, if you have to, you have to. I'll leave you in the competent hands of the other answers then. (Even though it's funny it has issues, and if it does, why are you doing it in VS2013 to begin with ?)

Community
  • 1
  • 1
Noctis
  • 11,507
  • 3
  • 43
  • 82
  • 3
    Yeah, I know that .. but I need it, because I've to import that service on an Android smartphone .. and Android have trouble with WCF web services :( – Robert Jaskowski Nov 29 '13 at 08:34
  • 1
    I beginn in VS2013 because I write a new MVC5 application which needs webservice support for android and on the other hand: it's the only tool I had :D – Robert Jaskowski Nov 29 '13 at 08:41
  • 1
    WCF is a Microsoft technology - it won't run (as a service) on an Android phone. Do you mean the clients are Android phones? What trouble are you having? – Tim Nov 29 '13 at 08:42
  • 1
    yes .. I mean that android is the client for the webservice my trouble is that the library "ksoap2-android" don't support .svc webservices only .asmx works fine -.- – Robert Jaskowski Nov 29 '13 at 08:43
  • 2
    What binding are you using? ksoap2-android should be fine calling a WCF service, but a quick search on Google shows some difficulties (at least in the past) with SOAP 1.2. If you haven't already, try using basicHttpBinding for your service (which is SOAP 1.1). – Tim Nov 29 '13 at 09:13
  • If Android has trouble with WCF, more likely it is your programming practice with WCF does not support good interoperability, then fix your WCF service rather than using a legacy technology which is obsolete, likely less interoperability and definitely less productive. – ZZZ Aug 17 '14 at 12:38
  • Agree... I was having problems consuming WCF with a Java Client. My WCF was a Custom Enpoint, I tried several frameworks, but it was too difficult, since I owned the WCF service, I changed it to basicHttpBinding and solved all my problems – Sebastian Castaldi Oct 16 '14 at 17:22
  • 1
    this is true in most cases. but i for example have to develop a web service to be used with infoPath 2007, good luck on messing with WCF ;) i wish i'd chosen ASMX in the beginning. – philx_x Jan 08 '15 at 15:11
  • @philx_x well, good thing we have google, so, and we're able to use the experience of others :) – Noctis Jan 08 '15 at 22:45
  • 1
    @Noctis although you are right, your answer remind me of this old picture :D http://geekwhisperin.files.wordpress.com/2009/09/bug-vs-feature.jpg – Lrrr Jan 19 '15 at 06:43
  • @AliAmiri you've summarized software development into one picture. well done :) – Noctis Jan 19 '15 at 22:56
  • 1
    I downvoted. I would avoid any proprietary technologies that are tied to only one brand. Plus, WCF is immensely more complicated than it needs to be. – vapcguy Sep 08 '15 at 19:48
  • @vapcguy you're downvoting because ...? asmx is Microsoft's, so is WCF. He didn't ask which is a free cross platform open technology, didn't he ? :). – Noctis Sep 08 '15 at 21:15
  • 2
    @Noctis It's not about if he asked for what was the better technology - it's that the answer was offered as being such, and it was incorrect. ASMX is not "legacy" functionality or it wouldn't be provided in VS 2013. Old, yes - "legacy", as in that it has totally been upstaged and replaced, no. And offering something that is complex like WCF and useful only in certain scenarios and knocking something that is easy, simple, ubiquitous, and cross-platform is not something we ought to be promoting on SO, IMHO. – vapcguy Sep 09 '15 at 13:37
  • 1
    @vapcguy now that's a fair explanation :) . WCF doesn't have to be complicated, but that's the start of a new argument . – Noctis Sep 09 '15 at 21:06
7

on the web site box, you have selected .NETFramework 4.5 and it doesn show, so click there and choose the 3.5...i hope it helps.

Kika_Fortez
  • 314
  • 3
  • 10
0

Check your namespaces. I had and issue with that. I found that out by adding another web service to the project to dup it like you did yours and noticed the namespace was different. I had renamed it at the beginning of the project and it looks like its persisted.

user1040975
  • 420
  • 5
  • 16