The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,733 other followers

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

Posted by jpluimers on 2013/11/27

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: