WCF Data Services - asp.net

I'm creating a Client Server app over a local network.
The UI will be built with WPF, and the server will expose an Entity Data Model (DBContext) through a WCF Data Service.
I'm a total newbie to WCF and ASP Net, but I know just the basics of the latter, my question is, since I'll have to use ASP Net as the hosting environment for my WCF Data Service, how much of ASP Net do I have to learn first, in order to learn about WCF Data Services?
(I know the basics, I studied Silverlight and when doing so I had to learn the basics of ASP NET)
Rafael

The quickstart starts with this step:
Create an ASP.NET Web application.
And as far as creating a WCF Data Service goes, that is all you'll have to do regarding ASP.NET.
Other ASP.NET / IIS-related things you might be interested in are authentication and various configuration issues, but as soon as you encounter one you can be sure it has been answered here on Stack Overflow.

Related

Recommended architecture - Server application that provides a ASP.NET Web front end

I'm having a look at the best way of developing a server application that presents an ASP.NET MVC front end for management/reporting.
The server app (service?) will also need to provide TCP listener as well as communicate to devices on a COM port.
The most obvious way I can think of doing this is to have an ASP.NET MVC web app and have a windows service that talks to the web app using a web calls/services. I guess then I'd talk to the service using the tcp listener or remoting?
The only other way would be to actually host an web server component in the service, and not use IIS which seems a bit to over the top.
Does anyone have any experience of this/recommendations?
It's a bit open ended but hope I've explained the basics.
TIA
Sam
I would probably try and decouple things a bit more.
Start off w/ a core project where all your business logic lies (agnostic of how users interact with it); sort of the DDD Domain Model idea.
Then, create two projects which consume that core project, one that is your MVC app, and another that's a WCF or ServiceStack-based service which can handle your TCP stuff.
Share state between them using the normal means; either inter-process comms, shared database, etc.
It sounds to me like you're looking for something very close to Windows Communication Foundation. Your requirements for IIS hosting, ASP.NET communication, and TCP communication. MSDN has a brief overview of WCF up here. There's also an article available about the transportation protocols here.
There are some good -- if a little old -- WCF questions here on Stack Overflow. I've just started delving into this world myself, and I have to admit that it's daunting at first. The Beginner's Guide (found under the first hyperlink above) has some slightly old, but very useful tutorial videos about WCF.
I will say that, although it may seem daunting or difficult, it's certainly better to use an existing, established technology for your purposes than to try to write your own homebrewed solution for something like this.
I started ServiceStack because I needed a high-performance web services framework option that promotes the correct way to develop web services.
ServiceStack can be run on top of any ASP.NET host or self-hosted using the HttpListener option. See the Starter Templates for example projects of a Console App or Windows Service hosts. Although even under IIS, ServiceStack is very fast and imposes very little overhead with a hello world service executing in sub <1ms response times.
ServiceStack also comes with .NET's fastest text serializers and a myriad of high-performance caching providers so you can escape the XML config bound ASP.NET's session and caching provider model.
Because ServiceStack encourages a clean message-based development model your same web services can take advantage of the Redis MQ Host allowing it to be invoked outside of HTTP context using Redis as a broker - with no code-changes required.
Redis is one of the fastest distributed NoSQL data stores.

Asp.net MVC utilising WCF

Looking into developing new startup with potential of hopefully having high volume.
Initial idea was to straight away have MVC talk to WCF services to create our Application Servers.
However after a little contemplating just wondering what benefits would I gain from using WCF services with MVC application?
If performance became an issue we could just keep adding new front web servers instead of application servers.
Enlighten me please, thanks
Don't start using fancy technology for the sake of using it or because it looks cool on paper. You'll have to support it and sometimes find yourself making things overly complicated because of the introduction of something that might not be necessary.
Said that, my current project also uses MVC 2 in combination with WCF. There it was an architectural decision made before I came to the project as they want to spread the tiers on different servers in different domains (outside and inside DMZ). The WCF service can only be called from the server hosting the MVC application so it should increase security.

I need advice regarding WCF and n-tier

First off, i'm fairly new to programming, I've built a few asmx web services but I am a little lost regarding how I should set up a WCF web service. I've tried to research this over the past couple days by reading through a lot of the documentation/articles/videos on MSDN but I'm still a confused.
Since my current web services are hosted on a separate box using IIS, from what I understand I need to create a WCF Library, then reference the Library in another WCF App and then host that app in IIS and reference the WCF App from my Front End? Seems like an extra step to me...? Not to mention a pain when developing on my local box.
Any advice or a point in the right direction would be very much appreciated. Thanks!
WCF gives you the option of sharing common assemblies (i.e. so both your service and clients can use the same domain model library), but it's not a necessary step.
You can host a WCF service through ASP.NET, same as ASMX. The "WCF Service Application" project template in Visual Studio configures it this way by default - as a WCF service hosted in IIS.
For the most common scenarios, it's really no different from ASMX. You create a WCF Service application, deploy it to a web server, and add service references in client applications. The importer will automatically generate classes for you, so you don't need to reference any assembly. No extra steps.
If you haven't already, you really should have a look through Microsoft's Tutorial. You'll find the steps very similar to those for setting up an ASMX-based architecture.

ASP.NET and Remoting

I have a .net application running on server. Now I want to comunicate between my ASp.NET website and the server application.
Currently I use database, server writes info to the db and site uses it etc. However adding new fields to echange and exchanging complex object is a pain.
Is remoting the way out? If yes, what are the common things to keep in mind while doing this.
both server and asp.net site is on the same server
both is under my control
is there any other better way than using remoting?
It is .NET 2.0
The purists will say that remoting is an old, dead technology, and the way to do it now is to use WCF.
If you're attempting to have some SOA thing, the best thing is to a web service for your server application and access it from your ASP.net website application. It's the best way to do.
However I don't really understand what the purpose of the "server" is? Couldn't your ASP.net website - as you say - be your front-end of the server application?? Your "server" would then simply be the business and data layer and there would be no need to use remoting or WCF.
I would say webservices if want to stay .net 2.0, otherwise it think you should take a look at WCF.
If you need direct interaction between assemblies (ASP.NET and some server application or service) you should use Application Domains and cross-domain calls (some good example here) or using WCF, which is better. Also you can use web services if your server application can be accessed via web without major resulting drawbacks (security issues, server deployment change, etc.).
Actually, u can deploy a WebService on that server. WebService is base on SOAP, it can exchange data object with your website.
If you can update to .Net Framwwork 3.5, you can try to use WCF instead.

Moving ASP.net webservices to WCF

I am verifying my login authentication using ASP.net webservices. But the client requested to move to WCF.
I need to know in what way WCF differs from ASP.net webservices.
What are the advantages for me to use WCF than ASP.net webservices.
Recently there was an episode about that topic on Dime Casts.NET:
Episode #73 - Migrating from .asmx web services to WCF web services
Also this article might be useful:
All About ASMX 2.0, WSE 3.0, and WCF by Aaron Skonnard
And the answers to the following question contain some good links:
What are the benefits of using WCF?
If your asmx is working fine then it's difficult to think of any "non-political" reasons for moving it over to WCF.
If the client is still adamant that is needs to be done then it should be a straightforward task. WCF has a shallow initial learning curve, and it's easy enough to just "learn what you need".. exposing a few methods shouldn't take you long at all.

Resources