<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vidar's Musings &#187; REST</title>
	<atom:link href="http://www.kongsli.net/nblog/tag/rest/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kongsli.net/nblog</link>
	<description>Deep thoughts on shallow topics</description>
	<lastBuildDate>Fri, 27 Jan 2012 07:36:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Adding WCF REST services to existing ASP.NET web application</title>
		<link>http://www.kongsli.net/nblog/2011/04/06/adding-wcf-rest-services-to-existing-asp-net-web-application/</link>
		<comments>http://www.kongsli.net/nblog/2011/04/06/adding-wcf-rest-services-to-existing-asp-net-web-application/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 13:14:09 +0000</pubDate>
		<dc:creator>vidarkongsli</dc:creator>
				<category><![CDATA[Microsoft technologies]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[System integration]]></category>
		<category><![CDATA[.net4]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[wcf4]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=243</guid>
		<description><![CDATA[If you want to create a new WCF services application with REST support, the WCF REST Templates are brilliant. However, if you have an existing ASP.NET application from which you want to expose REST services, there are a few manual steps you need to take to get it up and running: Add assembly references Add [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to create a new WCF services application with REST support, the <a href="http://visualstudiogallery.msdn.microsoft.com/fbc7e5c1-a0d2-41bd-9d7b-e54c845394cd">WCF REST Templates</a> are brilliant. However, if you have an existing ASP.NET application from which you want to expose REST services, there are a few manual steps you need to take to get it up and running:</p>

<h2>Add assembly references</h2>

<p>Add references to the following assemblies in your existing web project:</p>

<ul>
<li>System.ServiceModel</li>
<li>System.ServiceModel.Activation</li>
<li>System.ServiceModel.Web</li>
</ul>

<h2>Create service class</h2>

<p>Create a new service class where you will implement the service:</p>

<p><pre class="c-sharp" name="code">
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class LetterService
{
    [WebGet(UriTemplate = "")]
    public List&lt;string&gt; GetList()
    {
        return new List&lt;string&gt;{"a", "b", "c"};
    }
}
</pre></p>

<h2>Register service route</h2>

<p>In <code>Global.asax.cs</code>, define a route to the service:</p>

<p><pre class="c-sharp" name="code">
void Application_Start(object sender, EventArgs e)
{
    RouteTable.Routes.Add(new ServiceRoute("letter", new WebServiceHostFactory(), typeof(LetterService)));
}
</pre></p>

<h2>Enable ASP.NET compatability</h2>

<p>Add the following to <code>web.config</code>:</p>

<p><pre class="xml" name="code">
&lt;configuration&gt;
   &lt;system.serviceModel&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
   &lt;/system.serviceModel&gt;
&lt;/configuration&gt;
</pre></p>

<p>&#8230;and you are good to go! The service will be available on <code>http://&lt;server&gt;/letter</code></p>

<h2>Optional: enable help</h2>

<p>In order to get a nice help page for clients connecting to the service, add the following under the <code>system.serviceModel</code> element in <code>web.config</code>:</p>

<p><pre class="xml" name="code">
&lt;standardEndpoints&gt;
   &lt;webHttpEndpoint&gt;
      &lt;standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" /&gt;
   &lt;/webHttpEndpoint&gt;
&lt;/standardEndpoints&gt;
</pre></p>

<p>Then, help will be available on <code>http://&lt;server&gt;/letter/help</code></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.kongsli.net%2Fnblog%2F2011%2F04%2F06%2Fadding-wcf-rest-services-to-existing-asp-net-web-application%2F&amp;title=Adding%20WCF%20REST%20services%20to%20existing%20ASP.NET%20web%20application" id="wpa2a_2"><img src="http://www.kongsli.net/nblog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.kongsli.net/nblog/2011/04/06/adding-wcf-rest-services-to-existing-asp-net-web-application/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Explaining REST&#8230;</title>
		<link>http://www.kongsli.net/nblog/2008/06/04/explaining-rest/</link>
		<comments>http://www.kongsli.net/nblog/2008/06/04/explaining-rest/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 09:12:50 +0000</pubDate>
		<dc:creator>vidarkongsli</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[System integration]]></category>
		<category><![CDATA[representational state transfer]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=55</guid>
		<description><![CDATA[Not being sexist at all, I found this blog entry to be quite good: How I explained REST to my wife.]]></description>
			<content:encoded><![CDATA[<p>Not being sexist at all, I found this blog entry to be quite good: <a href="http://tomayko.com/writings/rest-to-my-wife">How I explained REST to my wife</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.kongsli.net%2Fnblog%2F2008%2F06%2F04%2Fexplaining-rest%2F&amp;title=Explaining%20REST%26%238230%3B" id="wpa2a_4"><img src="http://www.kongsli.net/nblog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.kongsli.net/nblog/2008/06/04/explaining-rest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

