in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, MOSS 2007, ASP.NET, LINQ, and Visual Studio 2012.

A second look at Indigo

The service that I described on Friday can be hosted in a variety of ways.  The first way is by using something called Windows Activation Service.  I have no idea what this is but supposedly it functions similar to IIS but can be used for Indigo services.  If anyone wants to figure out what that is and where it comes from, please let me know. 
 
The second way is that it can be hosted using a console application or more likely a windows service.  To do this a generic instance of the ServiceHost class is used.  You simply pass the class name of your Indigo service as the generic parameter of the ServiceHost class.  Once you have instantiated the class, you simply call the Open method to start accepting connections.
 
using System.ServiceModel;
 
public class MyClassHost
{
  public static void Main()
  {
      // instantiate the indigo service using a generic
      ServiceHost<MyClass> myClass =
      new ServiceHost<MyClass>();
      // open the indigo service so that it will accept connections 
      myClass.Open();
   }
}

The last thing that is necessary to host an Indigo service is to define a binding in a configuration file.  A binding simply specifies how the service can be accessed (i.e.: SOAP/HTTP, SOAP/TCP, etc.)  The complete list of bindings is available in the article.
 
A typical configuration file would look like this:
 
<configuration>
  <system.serviceModel>
    <services>
      <service serviceType="MyClass">
           <endpoint
          contractType="MyClass"
          bindingType="basicProfileHttpBinding />
      </service>
    </services>
  </system.serviceModel>
</configuration>

In this case the binding type is BasicProfileHttpBinding which is effectively SOAP over HTTPS.  Tomorrow, I will talk about creating an Indigo client.
 

Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=172

2012 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems