Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How can we host a service on two different protocols on a single server
How can we host a service on two different protocols on a single server?
✍: Guest
Let’s first understand what this question actually means. Let’s say we have made a service
and we want to host this service using HTTP as well as TCP. You must be wondering why
to ever host services on two different types of protocol. When we host a service it’s
consumed by multiple types of client and it’s very much possible that they have there
own protocol of communication. A good service has the capability to downgrade or
upgrade its protocol according the client who is consuming him.
Let’s do a small sample in which we will host the ServiceGetCost on TCP and HTTP
protocol.
Below is the code snippet pasted from the same sample. As usual we have numbered
them and here is the explanation of the same:
1 and 2 -- As we are hosting the service on two protocols we need to create two objects
if the URI. You can also give the URI through config file. Pass these two objects of the
URI in the constructor parameter when creating the service host object.
Figure 15.21:- Server side code for Multi Protocol hosting
3 – In the config file we need to define two bindings and end point as we are hosting the
service in multiple protocols.
Once we are done the server side coding its time to see make a client by which we can
switch between the protocols and see the results. Below is the code snippet of the client
side for multi-protocol hosting.
2007-11-04, 5728👍, 0💬
Popular Posts:
Rachel opened her math book and found that the sum of the facing pages was 245. What pages did she o...
.NET INTERVIEW QUESTIONS - What is the difference between thread and process? A thread is a path of ...
Managed Code and Unmanaged Code related ASP.NET - How do you hide Public .NET Classes and other publ...
How To Use mysqlbinlog to View Binary Logs? - MySQL FAQs - Server Daemon mysqld Administration If yo...
How To View All Columns in an Existing Table? - Oracle DBA FAQ - Managing Oracle Database Tables If ...