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 :)

4 Answers 4

103
  1. Create Empty ASP.NET Project enter image description here
  2. Add Web Service(asmx) to your project
    enter image description here
3
  • looks very simple ^^ but I didn't have this template(?) I'm using VS2013 Professional Nov 29, 2013 at 8: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) Nov 29, 2013 at 8:58
  • 5
    wondering if it's a bug, or really a 'feature', as per my answer ;)
    – Noctis
    Nov 29, 2013 at 9: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 ?)

15
  • 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 :( Nov 29, 2013 at 8: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 Nov 29, 2013 at 8: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, 2013 at 8:42
  • 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, 2013 at 9:13
  • 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 9, 2015 at 13:37
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.

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.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.