Is Web Service in ASP.NET obsolete? What to use with ASP.NET 4.0? - asp.net

I have to write a simple Web Service application in ASP.NET. I read somewhere that Web Services is now obsolete and some new technologies like WCF is there.
But as the name suggests, Windows Communication Foundation, might me restricted to WinForms applications only and not for ASP.NET. What shall I use with Visual Studio 2010?
I want to build a simple Web Forms application and not MVC.

What shall I use with Visual Studio 2010?
You have many choices other than ASP.NET Web Services which are completely obsolete now. So if you are starting a new project and need to develop a web service you might consider:
WCF
ASP.NET Web API
ServcieStack
ASP.NET MVC
But as the name suggests, Windows Communication Foundation, might me
restricted to WinForms applications only
The name is misleading. WCF has strictly nothing to do with Windows Forms only. You could host a WCF service in an ASP.NET application or self-host it if you want.

Simple Web Service application in ASP.NET (webForm OR mvc) ?
My firt choice : ASP.NET WebApi
Easy to unit test
Easy to secure
Restful
Still, WCF is pretty cool too because it is very well integrated with VS, and easy to configure through web.config
Both WebApi and WCF make it possible to version your web services.

Related

ASP.Net web form "not" web API with Owin or self hosting?

I have an ASP.Net webform application , deployed on IIS , now I want to make it self hosted application , I found that Owin can do it , but I am unable to find a way to do it with ASP.Net webform , I have found code with Owin and webapi .I did not found any tutorial or any help on internet .
It's not possible, I go into the details here http://keyoti.com/blog/asp-net-v5web-apivnextowin-a-beginners-primer-part-1/ but basically Web Forms uses System.Web assembly, and System.Web is coupled to IIS.
You can however self host MVC with ASP.NET 5, if that is any use.
Microsoft only developed Katana/Owin partially and then realized they had to dump ASP.NET WebForms/MVC/Web API/SignalR completely and embraced the new design, ASP.NET Core.
Thus, you can only use Katana to self host Web API and SignalR officially from Microsoft. But third party vendors, such as Cassini, allow you to bundle the web server with your web app, which is another approach to achieve self hosting,
Creating a standalone ASP.NET MVC application for Windows XP

Host ASP.NET App In WCF or Generic Web Server

Objective:
We have a Windows Service/generic EXE that also hosts a WCF service (.Net 3.5). I'd like to be able to take a third party ASP.NET component in a DLL, and host it through that WCF Service.
Is this possible to do, in any way?
It seems like if you want to host a ASP.NET app, it must be through IIS, but we don't use IIS.
Is there any way that we could load the ASP.NET app into memory, make the app available through an endpoint, and receive requests back from the app?
Specifically, we'd like to take the "Microsoft.ReportViewer.WebForms.dll", expose the web form in a web page, and accept any requests back from the web form.
http://msdn.microsoft.com/en-us/library/ms251723.aspx
Looking for anything to get me started. Thx.
From owin.org
"OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application, encourage the development of simple modules for .NET web development, and, by being an open standard, stimulate the open source ecosystem of .NET web development tools."
Essentially Owin implementations, like Katana (OWIN implementations for Microsoft servers and frameworks.), help you self host web apps, even in a Windows NT Service.
According to this post, hosting a WebForms app outside IIS/ASP.NET is not possible.
WebForms are tightly coupled to ASP.NET/IIS and cannot run directly on
OWIN/Katana (e.g. outside of ASP.NET/IIS). However, you should be able
to use Katana's middleware (Security, CORS, etc.) in a WebForms
application.
http://katanaproject.codeplex.com/discussions/571291

can i use wcf rest service in my asp.net 3.5 web application

I heard that rest services are moved from wcf to asp.net web api frame work.
Our web application is built on vs 2010 (asp.Net 3.5) .So still i can use wcf rest services in my web application?
Please suggest some alternatives if it is not possible.
WCF can still be used to build RESTful services1, many services are already built with it and it's not going away. What you heard is that most of the new developments in terms of new functionality in the area by Microsoft will be made in the ASP.NET Web API framework, not in WCF. But as all the services out there can attest, WCF for building web services is still a valid alternative, if it does all you need.
1 The official name is actually "WCF Web HTTP Services"; REST is a well-defined set of constraints which need to be implemented, which would give the service some useful properties. There are some people who argue that people should stop using the term REST for all HTTP-based, non-SOAP services.

Are these usages of OWIN possible?

Is it possible to write a simple custom Console Application that includes a owin library that can host a Asp.Net Web Application directly (without katana.exe, like CassiniDev's library)?
Is it possible to let an Asp.Net Web Application including MVC 4, Web API, SignalR features hosted across IIS and owin, without / rarely changing code?
For hosting applications from the ASP .NET framework family on top of OWIN, as of this post, you can do so with WebAPI and SignalR. If you need something more like MVC and Razor, you can look at using the NancyFX web app framework for that. Maybe in future versions of MVC OWIN support will be enabled
I did an initial implementation of adapter at https://github.com/ashmind/Gate.Adapters.AspNet.
It is absolutely not production ready, but if the functionality is important for you you are welcome to test/extend it.
As far as I know there is no other reliable library for that.

ASP.NET Web Service Application in .net 4

I was going through the MSDN walkthrough on using client application services.
http://msdn.microsoft.com/en-us/library/bb546195.aspx
This is for .net 3.5..but i need to do it in .net 4. The thing is that it doesn't have any ASP.NET Web Service Applications listed. Has it introduced any replacement for that? Or is there any workaround?
Regards.
One of the way is to select target platform as .NET 3.5 in the drop-down at the top of New Project dialog - this will allow you to select "ASP.NET Web Service Application" project template. Once you select the template, you may change the target platform to .NET 4 using project properties.
I believe that the main reason for this template not being available in .NET 4 view is that this project uses ASP.NET web services (asmx files). Microsoft has declared this to be an obsolete technology and recommends to use WCF services instead.
You can expose ASP.NET application services (authentication, role etc used the sample sited by you) as WCF services. See section titled "Using application services as WCF services" in this link. So I will recommend you to choose ASP.NET Web Application project and then expose ASP.NET services as WCF services.
Instead web services use WCF, it has more features than asp.net Web Services
http://msdn.microsoft.com/en-us/library/ms731082.aspx

Resources