Quantcast
Channel: Visual Studio and tools – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 239

Two ways of adding a classic .asmx WebService in .net 4+ using Visual Studio 2010 SP1 and up (via: Stack Overflow)

$
0
0

As of Visual Studio 2010 SP1 (I think it was there in the original non-SP1 version of VS2010), Microsoft has hidden the addition of classic ASCX webservices as they favour WCF over ASPX (there are quite a few differences).

It is easy to workaround though as Stack Overflow users User Cyberherbalist and User Alejandro Martin have shown, with a little bit post-editing from me:

They’ve obscured it, but it’s easy enough:

Workaround 1:

  1. Right-click on your solution, select Add New Project.
  2. In the Framework selection dropdown, select .NET Framework 3.5
  3. Select the Web installed templates listing and you’ll find ASP.NET Web Service Application as the last one in the list.

In other words, you can create one in .NET 3.5, but not 4. Now, that being said, it seems like it may be possible to create a .NET 4 template for VS2010, but I’m not a VS2010 guru, so that’s for someone else to elaborate on.

Workaround 2

Edited to Add: Somebody else posted a response to your question that was also a good answer, I thought, but they deleted it themselves for some reason. I don’t remember their user name. I’ll repeat it here.

  1. Create a new Web Application in the solution,
  2. In this solution, Add New Item, and one of the options under Web is “Web Service” at the very bottom.

Discussion

The only drawback to this is that besides the web service, you also have the usual default items for a web application, namely default.aspx, about.aspx, global.asax, and site.master, as well as the folders Account, Scripts, and Styles. But you can delete these, so no problem. Also keep in mind that the web.config in the Web Application project will be different from that of the Web Service, and that the assembly bindings for the web service will point to ASP.NET v2 & v3.5 (see its web.config), whereas the service in the web application project will default to ASP.NET v4 (through its project file). I don’t know if any negative implications exist for either way of working, though I suspect that both will work just fine.

Research steps to do: compare the various web.config versions added by both workarounds to the one generated in the non-SP1 version of Visual Studio 2010.

–jeroen

via: How can I add a web service project using Visual Studio 2010? – Stack Overflow.


Filed under: .NET, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 4.0, C# 5.0, Development, SOAP/WebServices, Software Development, Visual Studio 11, Visual Studio 2010, Visual Studio and tools

Viewing all articles
Browse latest Browse all 239

Trending Articles