I have a desktop application built with WPF and a asp.net mvc web application which is located on IIs.
They should exchange information between themselves. Both also have a sql server database.
My question is: What is the best way to create the relationship between the two programs together?
Can WCF a reliable method?
WCF has a class called CallbackContract which can be specified in the ServiceContract attributes. For details you can go to MSDN: https://msdn.microsoft.com/en-us/library/ms731064%28v=vs.110%29.aspx
Related
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.
I'm integrating a product from another vendor with our existing processes.
This product interfaces with our system via an ASP.NET Web Service. As in, I need to write an ASP.NET Web Service that has the particular method names and parameters that the vendor has specified.
Simple enough, but we're wanting to migrate as much stuff as possible to WCF. I haven't used WCF much yet, but as I see it it's the replacement for ASP.NET Web Services (and other things).
Seeing as how I cannot modify the vendor's product, the only way I could write this new web service using WCF is if a WCF Service can be consumed as if it were an ASP.NET Web Service (i.e., as far as the vendor's product is concerned, it is consuming an ASP.NET Web Service).
Can WCF Services be consumed in this way?
yes, web services are web services. In general WCF is more flexible and more powerful than ASP.NET, but you can get the on-the-wire message into and out of a WCF service to look exactly the same as the messages for an ASMX service. But, WCF is also different by default.
Migrating should be almost mechanical. Replace the .asmx file containing this:
<%# WebService
Language="C#"
CodeBehind="~/App_Code/CommunicationService.cs"
Class="CommunicationService" %>
...with a .svc file containing this:
<%# ServiceHost
Language="C#"
CodeBehind="~/App_Code/CommunicationService.cs"
Service="CommunicationService" %>
...and you are nearly done.
But, the default settings for a WCF web service are different than those for an ASP.NET web service. In particular, the XML namespaces of the incoming and outgoing messages may be different. Not everybody specifies distinct xml namespaces for their service and messages, but for those who do, migration will be an issue. The difference in behavior (WCF-vs-ASPNET) will cause apps that successfully were able to call an ASMX service, to not work with a "converted" WCF service.
This article discusses the issue in some detail, and describes a good workaround: use a custom ServiceHost.
The service host code in the article above is incomplete in that it works to fix only the request schema; you might/could also need to do something similar for the response schema.
Good luck.
In addition to the other answers and pointing to your Migration concern, you can STILL open to keep your old Webservices working as it is now, but point these Webservices(Existing) to WCF Host Service. So new as well as old Webservice work seamlessly.
can you please tell me what is the difference between webservice and webapplication.
A web service:
Typically returns XML or JSON or something like that, something that is easily decoded by a program
The results you get from a web service is typically not just shown to a person in its raw form (ie. since it isn't HTML, the results have to be reformatted, like placed into a form)
The intended usage of a web service is that it is something an application can talk to
A web application
Typically returns HTML or image data or similar
The results you get from a web application is usually shown to a person, through a web browser
As for similarities:
Both typically use HTTP(S) as the transport
Both typically use HTTP authentication/authorization to secure data
Both are typically hosted by a web server
So the main difference is who usually talks to them. A web service usually by another application, a web application usually by a web browser. Other than that they're pretty similar.
Here is the Web Application and here is Web Service
Web application: any application which resides on a server, and mainly used by human using web browser. All user interactivity is done through web pages.
Web service: server-based application (as above) which may be accessed over the web via HTTP, but is meant primarily for interaction with other programs. Generally it is WEB API for other applications.
In a nutshell, a Webservice uses special HTTP transport protocols to communicate to other servers. Webservices are meant to be used by other applications.
In the ASP.Net world, a web application is a type of Visual Studio project that allows building ASP.Net websites in a particular configuration. E.g. A Webservice can be built using a Web Application type project. Or a Web Application can also refer to a website that is meant to be used directly by an end-user ( unlike web services ).
Here are a few links and related SO questions...
What is the difference between an asp.net web method and a wcf service?
ASP.NET Web Site or ASP.NET Web Application?
Introduction to Web Services and ASP.NET
check this
http://en.wikipedia.org/wiki/Web_service
http://www.w3schools.com/webservices/ws_intro.asp
How to retrieve data from database using Web services on VB?
Does it have to be a web service? Have you considered WCF? (Windows Communication Foundation)
http://msdn.microsoft.com/en-us/netframework/aa663324.aspx
If I understand you correctly, you are asking how to setup a web service using vb.net to communicate with the database and return the results.
If that is correct, then there are 2 parts:
How to write a web service
How to communicate with a database
Here are three pages that will help you create a web service:
vbdotnetheaven
codeguru
techrepublic
As for the database, if you are talking about SQL Server, then see this page here and this page here
Your question isn't clear enough. Are you trying to access a web service run by ASP.NET using VB? If yes, you can make SOAP request to your web service easily using VB, your web service will then fetch the data from database and return to you. You can have a look at this tutorial on how to make a SOAP request using VB -
http://www.aspfree.com/c/a/VB.NET/Calling-a-Web-Service-using-VB6-with-SOAP-30/1/
Hope that helps.
Create a proxy class from the web service's WSDL, using Visual Studio's "Add Web Reference" feature
Configure the proxy, such as for security, if needed (the details depend on the API)
Call the proxy from your code
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.